On ubuntu i can go into /etc/init/docker.conf
and put in DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'
to get the json data to display on my browser but how can i do it for Centos?
I have tried creating a file in /etc/sysconfig/docker
and placing other_args="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock"
inside the file and restarting docker but it doesn't do anything.
The systemd unit installed by the Docker corp package hardcodes the command line used to start the docker daemon:
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
[...]
There is no support for reading a file from /etc/sysconfig
or elsewhere to modify the command line. Fortunately, systemd gives us the tools we need to change this behavior.
The simplest solution is probably to create the file /etc/systemd/system/docker.service.d/docker-external.conf
(the exact filename doesn't matter; it just needs to end with .conf
) with the following contents:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock
And then:
systemctl daemon-reload
systemctl restart docker
This is actually documented on the Docker website in this document, which includes instructions for a more flexible solution that will allow you to use files in /etc/sysconfig
to control the daemon.