I´m new to docker and want to start it in daemon mode listening to a specific IP-adress and port. In the documentation it is said that this can be done by writing sudo /usr/bin/docker daemon -H 0.0.0.0:5555
. It then says that I can list running containers with this command docker ps
. If I try this I get the following message:
Get http:///var/run/docker.sock/v1.20/containers/json?all=1: dial unix /var/run/docker.sock: no such file or directory.
- Are you trying to connect to a TLS-enabled daemon without TLS?
- Is your docker daemon up and running?
I cannot interact with it. I´ve searched for a solution but with no luck. Any suggestions?
P.S. How can I run this daemon in background? I tried appending an & but I´m stuck on the ouput till pressing ctrl+c.
Thanks in advance
On Ubuntu (16.04 LTS) with docker-ce (
17.03.1~ce-0~ubuntu-xenial
) do the following to make docker listen to a TCP port instead of sockets.Add a file
/etc/systemd/system/docker.service.d/override.conf
with the following content:Add a file
/etc/docker/daemon.json
with the following contentReload (
systemctl daemon-reload
) and restart (systemctl restart docker.service
) docker.For reference: https://github.com/moby/moby/issues/25471
EDIT:
Be careful, so the demon will only listen to that network port ignoring local requests. To make docker listen to both remote and local, edit daemon.json but keep the standard unix socket
Docker daemon connection options docs
On Mac OSX you'd run the Docker Quickstart Terminal App to see:
...
now
should work
On Linux e.g. Ubuntu prepending sudo might be necessary. E.g.
will lead to:
but
will work.
See https://docs.docker.com/articles/basics/
To check if your docker service is running you can call
and it should show:
Sometimes your docker instllation might be corrupt see: Docker daemon does not start or restart
For some reason Phoenix's solution was giving me error. So i found an alternate way-
I edited /etc/sysconfig/docker and changed the OPTIONS parameter
then i restarted the docker daemon
and it worked.
I found a solution to my problem. I specified docker running on IP x and Port y, but docker then only listens to that socket. I had to add another -H flag with the unix socket in order to listen to local requests:
This thread is quite useful, so I'd like to contribute how to get this to work on Ubuntu
14.04.1 LTS
with docker1.12.6-cs13
(might work with docker-ce versions just as well). Thesystemd
approach (also/etc/sysconfig/docker
) is not possible for this Ubuntu vintage, the official docker documentation as of this writing has no post-install guide for making docker daemon listen on network usingupstart
for Ubuntu14.04.1 LTS
. I found that below approach works rather well:create
/etc/default/docker
file with contentDOCKER_OPTS = "-H tcp://MACHINE-IP:2375 -H unix:///var/run/docker.sock"
restart docker service
sudo service docker restart
. After doing this, docker daemon started listening on network and the daemon logs looked clean. Perhaps more experienced docker users can chime in if there is a better way.