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 running Docker in Virtualbox on an Ubuntu VM). However, when I try to run any Docker commands now, I just get this error message:
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
I have tried sudo service docker restart, and restarted the machine, but nothing has worked. Any idea what the problem is?
To use the daemon through the tcp socket the option
-H tcp://0.0.0.0:2375
should be added to the commanddocker
(both for thedaemon
andrun
).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: