Compose: Compose exits with "Missing dependencies for SOCKS support"

Created on 6 Jun 2017  路  5Comments  路  Source: docker/compose

Hi there! Ran into a bit of an issue with docker-compose 1.13.0, build 1719ceb. In my test the issue goes back to at least 1.11.0.

A script I'm running does docker-compose down, which results in an uncaught exception that ends with the line: "requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.":

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 68, in main
  File "compose/cli/main.py", line 118, in perform_command
  File "compose/cli/main.py", line 358, in down
  File "compose/project.py", line 286, in down
  File "compose/project.py", line 252, in stop
  File "compose/project.py", line 498, in containers
  File "compose/project.py", line 489, in _labeled_containers
  File "site-packages/docker/api/container.py", line 189, in containers
  File "site-packages/docker/utils/decorators.py", line 47, in inner
  File "site-packages/docker/api/client.py", line 183, in _get
  File "site-packages/requests/sessions.py", line 488, in get
  File "site-packages/requests/sessions.py", line 475, in request
  File "site-packages/requests/sessions.py", line 596, in send
  File "site-packages/requests/adapters.py", line 390, in send
  File "site-packages/docker/transport/ssladapter.py", line 56, in get_connection
  File "site-packages/requests/adapters.py", line 290, in get_connection
  File "site-packages/requests/adapters.py", line 184, in proxy_manager_for
  File "site-packages/requests/adapters.py", line 43, in SOCKSProxyManager
requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.

I'm running through docker machine and nothing in the docker compose yaml even mentions socks.

The script that wraps the docker-compose does set ALL_PROXY, which I think may be causing requests or some other library to eagerly load socks support.

My recommendation would be to add requests[socks] to the setup.py and call it good.

kinquestion

Most helpful comment

It seems unfriendly for users to have to figure out what extra packages they need to use the features supported by docker-compose - maybe setup.py can have a extras option that includes all of these packages, and the distribution channels for the frozen version of docker-compose can install docker-compose with that option instead?

All 5 comments

Thanks for the report!

The majority of people do not need those additional dependencies - adding extra dependencies indiscriminately seems like a poor solution. The onus is on the script provider to ensure additional requirements are included, or at least properly advertised.

docker-compose is being distributed as a frozen binary, which means adding requirements after the fact is not really possible.

Yeah, this is for the frozen command, not the pip installed version. And this would affect anyone with the rather innocuous ALL_PROXY environment variable configured.

In any case the PySocks module is the only dependency required, and it is really very tiny (literally one file). The version is managed automatically by simply using the socks requests extra (requests[socks]).

It seems unfriendly for users to have to figure out what extra packages they need to use the features supported by docker-compose - maybe setup.py can have a extras option that includes all of these packages, and the distribution channels for the frozen version of docker-compose can install docker-compose with that option instead?

That would be a reasonable addition.

Was this page helpful?
0 / 5 - 0 ratings