{"action":"created","issue":{"url":"https://api.github.com/repos/docker/compose/issues/4483","repository_url":"https://api.github.com/repos/docker/compose","labels_url":"https://api.github.com/repos/docker/compose/issues/4483/labels{/name}","comments_url":"https://api.github.com/repos/docker/compose/issues/4483/comments","events_url":"https://api.github.com/repos/docker/compose/issues/4483/events","html_url":"https://github.com/docker/compose/issues/4483","id":207484061,"number":4483,"title":"Exception on 404 when using the HTTP interface directly","user":{"login":"ColinHebert","id":232139,"avatar_url":"https://avatars.githubusercontent.com/u/232139?v=3","gravatar_id":"","url":"https://api.github.com/users/ColinHebert","html_url":"https://github.com/ColinHebert","followers_url":"https://api.github.com/users/ColinHebert/followers","following_url":"https://api.github.com/users/ColinHebert/following{/other_user}","gists_url":"https://api.github.com/users/ColinHebert/gists{/gist_id}","starred_url":"https://api.github.com/users/ColinHebert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ColinHebert/subscriptions","organizations_url":"https://api.github.com/users/ColinHebert/orgs","repos_url":"https://api.github.com/users/ColinHebert/repos","events_url":"https://api.github.com/users/ColinHebert/events{/privacy}","received_events_url":"https://api.github.com/users/ColinHebert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-02-14T11:01:52Z","updated_at":"2017-02-14T20:15:26Z","closed_at":null,"body":"Hi guys.\r\n\r\nI've been struggling with a weird issue:\r\n\r\n```\r\ncompose.cli.verbose_proxy.proxy_callable: docker inspect_network <- (u'mytest_default')\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/docker-compose\", line 11, in <module>\r\n    sys.exit(main())\r\n  File \"/usr/local/lib/python2.7/dist-packages/compose/cli/main.py\", line 88, in main\r\n    command()\r\n  File \"/usr/local/lib/python2.7/dist-packages/compose/cli/main.py\", line 140, in perform_command\r\n    handler(command, command_options)\r\n  File \"/usr/local/lib/python2.7/dist-packages/compose/cli/main.py\", line 900, in up\r\n    remove_orphans=remove_orphans)\r\n  File \"/usr/local/lib/python2.7/dist-packages/compose/project.py\", line 387, in up\r\n    self.initialize()\r\n  File \"/usr/local/lib/python2.7/dist-packages/compose/project.py\", line 431, in initialize\r\n    self.networks.initialize()\r\n  File \"/usr/local/lib/python2.7/dist-packages/compose/network.py\", line 203, in initialize\r\n    network.ensure()\r\n  File \"/usr/local/lib/python2.7/dist-packages/compose/network.py\", line 59, in ensure\r\n    data = self.inspect()\r\n  File \"/usr/local/lib/python2.7/dist-packages/compose/network.py\", line 91, in inspect\r\n    return self.client.inspect_network(self.full_name)\r\n  File \"/usr/local/lib/python2.7/dist-packages/compose/cli/verbose_proxy.py\", line 55, in proxy_callable\r\n    result = getattr(self.obj, call_name)(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py\", line 35, in wrapper\r\n    return f(self, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/api/network.py\", line 158, in inspect_network\r\n    return self._result(res, json=True)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/api/client.py\", line 216, in _result\r\n    self._raise_for_status(response)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/api/client.py\", line 210, in _raise_for_status\r\n    response.raise_for_status()\r\n  File \"/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/models.py\", line 840, in raise_for_status\r\nrequests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://docker:2375/v1.25/networks/baseagent_default\r\n```\r\n\r\nFrom the looks of it, the client fails to recover from a 404 (an expected one, the network `mytest_default` doesn't exist yet.\r\n\r\nI have been able to create a more self-contained test to reproduce the error (spoiler alert it relies on dind, but that should be irrelevant): https://github.com/ColinHebert/compose-404\r\nIt may sound a bit convoluted but here is what's happening:\r\n - docker-compose.yaml starts two containers, the first one is dind (the one we're going to test against through http). It uses privileges to run docker properly.\r\n - The second container runs a docker container \"client\" which is an ubuntu box with docker-compose installed. The client container is linked to dind container and has the env variable `DOCKER_HOST=docker:2375` (meaning that docker commands run inside this container are going straight to dind\r\n - When starting the client container, we attempt to run docker-compose which ends up failing on the 404.\r\n\r\nI'm not 100% across the reason why the HTTP 404 bubbles up in my case. When running against a socket (albeit a different environment), the 404 gets caught properly ending with:\r\n\r\n```pip._vendor.requests.packages.urllib3.connectionpool._make_request: \"GET /v1.25/networks/mytest_default HTTP/1.1\" 404 50```"},"comment":{"url":"https://api.github.com/repos/docker/compose/issues/comments/279822604","html_url":"https://github.com/docker/compose/issues/4483#issuecomment-279822604","issue_url":"https://api.github.com/repos/docker/compose/issues/4483","id":279822604,"user":{"login":"ColinHebert","id":232139,"avatar_url":"https://avatars.githubusercontent.com/u/232139?v=3","gravatar_id":"","url":"https://api.github.com/users/ColinHebert","html_url":"https://github.com/ColinHebert","followers_url":"https://api.github.com/users/ColinHebert/followers","following_url":"https://api.github.com/users/ColinHebert/following{/other_user}","gists_url":"https://api.github.com/users/ColinHebert/gists{/gist_id}","starred_url":"https://api.github.com/users/ColinHebert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ColinHebert/subscriptions","organizations_url":"https://api.github.com/users/ColinHebert/orgs","repos_url":"https://api.github.com/users/ColinHebert/repos","events_url":"https://api.github.com/users/ColinHebert/events{/privacy}","received_events_url":"https://api.github.com/users/ColinHebert/received_events","type":"User","site_admin":false},"created_at":"2017-02-14T20:15:26Z","updated_at":"2017-02-14T20:15:26Z","body":"Indeed, I thought it was docker-py 2.0.2 as well, but it clearly isn't the case.\r\n\r\nI've been staring at the diff between 1.10.0 and 1.10.1 in github and nothing in there seems to be relevant to the problem"}}
{"actor":{"display_login":"ColinHebert"}}