How to access Docker daemon through tcp-socker?

前端 未结 1 379
一整个雨季
一整个雨季 2021-01-16 02:58

I have added

DOCKER_OPTS=\"-H tcp://0.0.0.0:2375\"

to /etc/default/docker to make the Docker API accessible on my host machine (I\'m runnin

相关标签:
1条回答
  • 2021-01-16 03:52

    To use the daemon through the tcp socket the option -H tcp://0.0.0.0:2375 should be added to the command docker (both for the daemon and run).

    To access the daemon with its default unix socket make sure that the Docker daemon is also started with the option -H=unix:///var/run/docker.sock.


    Note that using the tcp is dangerous if you do not trust the network you are in. Here is the doc from the man page:

       -H, --host=[unix:///var/run/docker.sock]: tcp://[host]:[port][path] to bind or unix://[/path/to/socket] to use.
         The socket(s) to bind to in daemon mode specified using one or more
         tcp://host:port/path, unix:///path/to/socket, fd://* or fd://socketfd.
         If the tcp port is not specified, then it will default to either 2375 when
         --tls is off, or 2376 when --tls is on, or --tlsverify is specified.
    
    0 讨论(0)
提交回复
热议问题