{"action":"created","issue":{"url":"https://api.github.com/repos/pyouroboros/ouroboros/issues/254","repository_url":"https://api.github.com/repos/pyouroboros/ouroboros","labels_url":"https://api.github.com/repos/pyouroboros/ouroboros/issues/254/labels{/name}","comments_url":"https://api.github.com/repos/pyouroboros/ouroboros/issues/254/comments","events_url":"https://api.github.com/repos/pyouroboros/ouroboros/issues/254/events","html_url":"https://github.com/pyouroboros/ouroboros/issues/254","id":418250988,"node_id":"MDU6SXNzdWU0MTgyNTA5ODg=","number":254,"title":"ouroboros sets fixed IP addresses","user":{"login":"fabianonline","id":810163,"node_id":"MDQ6VXNlcjgxMDE2Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/810163?v=4","gravatar_id":"","url":"https://api.github.com/users/fabianonline","html_url":"https://github.com/fabianonline","followers_url":"https://api.github.com/users/fabianonline/followers","following_url":"https://api.github.com/users/fabianonline/following{/other_user}","gists_url":"https://api.github.com/users/fabianonline/gists{/gist_id}","starred_url":"https://api.github.com/users/fabianonline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabianonline/subscriptions","organizations_url":"https://api.github.com/users/fabianonline/orgs","repos_url":"https://api.github.com/users/fabianonline/repos","events_url":"https://api.github.com/users/fabianonline/events{/privacy}","received_events_url":"https://api.github.com/users/fabianonline/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-03-07T11:03:15Z","updated_at":"2019-03-09T19:27:23Z","closed_at":null,"author_association":"NONE","body":"Hi.\r\n\r\nAfter rebooting my server, I've noticed that some containers were in a state of \"Stopped (255)\" and couldn't be restarted anymore. Trying to do so yielded an `Error response from daemon: Address already in use`. Recreating them did work, but I would rather like them to be automatically restarted after a reboot like all the other containers.\r\n\r\nAfter some thinking about this I think I found the problem: ouroboros sets fixed IP adresses on containers it restarts. These persist even after a reboot of the server. But all containers that were not touched by ouroboros still don't have a fixed IP and will dynamically grep the first available one - which can happen to be one attached to a not-yet-running-but-about-to-be-started container. This will of course prevent that container from starting...\r\n\r\nI did a `docker inspect` of a container after creating it and again after ouroboros updated it. A diff yielded (amongst other things like changed Id and Created values):\r\n\r\n```diff\r\n             \"Networks\": {\r\n                 \"ldap\": {\r\n-                    \"IPAMConfig\": {},\r\n+                    \"IPAMConfig\": {\r\n+                        \"IPv4Address\": \"172.22.0.4\"\r\n+                    },\r\n                     \"Links\": null,\r\n                     \"Aliases\": [\r\n-                        \"1b32d47d1fef\"\r\n+                        \"1b32d47d1fef\",\r\n+                        \"2745cfe3c1c0\"\r\n                     ],\r\n...\r\n                 \"mariadb\": {\r\n-                    \"IPAMConfig\": null,\r\n+                    \"IPAMConfig\": {\r\n+                        \"IPv4Address\": \"172.18.0.2\"\r\n+                    },\r\n                     \"Links\": null,\r\n                     \"Aliases\": [\r\n-                        \"1b32d47d1fef\"\r\n+                        \"1b32d47d1fef\",\r\n+                        \"2745cfe3c1c0\"\r\n                     ],\r\n...\r\n                 \"nginx\": {\r\n-                    \"IPAMConfig\": {},\r\n+                    \"IPAMConfig\": {\r\n+                        \"IPv4Address\": \"172.19.0.12\"\r\n+                    },\r\n                     \"Links\": null,\r\n                     \"Aliases\": [\r\n-                        \"1b32d47d1fef\"\r\n+                        \"1b32d47d1fef\",\r\n+                        \"2745cfe3c1c0\"\r\n                     ],\r\n```\r\n\r\nI think this matches my hypothesis.\r\n\r\nExpected behaviour would be that ouroboros doesn't set a fixed IP if there isn't a fixed IP to begin with."},"comment":{"url":"https://api.github.com/repos/pyouroboros/ouroboros/issues/comments/471214222","html_url":"https://github.com/pyouroboros/ouroboros/issues/254#issuecomment-471214222","issue_url":"https://api.github.com/repos/pyouroboros/ouroboros/issues/254","id":471214222,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3MTIxNDIyMg==","user":{"login":"circa10a","id":21261388,"node_id":"MDQ6VXNlcjIxMjYxMzg4","avatar_url":"https://avatars3.githubusercontent.com/u/21261388?v=4","gravatar_id":"","url":"https://api.github.com/users/circa10a","html_url":"https://github.com/circa10a","followers_url":"https://api.github.com/users/circa10a/followers","following_url":"https://api.github.com/users/circa10a/following{/other_user}","gists_url":"https://api.github.com/users/circa10a/gists{/gist_id}","starred_url":"https://api.github.com/users/circa10a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/circa10a/subscriptions","organizations_url":"https://api.github.com/users/circa10a/orgs","repos_url":"https://api.github.com/users/circa10a/repos","events_url":"https://api.github.com/users/circa10a/events{/privacy}","received_events_url":"https://api.github.com/users/circa10a/received_events","type":"User","site_admin":false},"created_at":"2019-03-09T19:27:23Z","updated_at":"2019-03-09T19:27:23Z","author_association":"MEMBER","body":"This is by design:\r\nhttps://github.com/pyouroboros/ouroboros/blob/master/pyouroboros/dockerclient.py#L153\r\n\r\nWe've seen several issues with keeping network configs for things that dynamically provision docker networks like docker-compose and I dont think there's a way to determine if the ip address was manually set or not."}}
{"actor":{"display_login":"circa10a"}}