Monday, December 25, 2017

docker enabling remote daemon administration

one can use the -H option

don't try to use /etc/docker/daemon.json , it's not supported for this option

Do this:

sudo less /usr/lib/systemd/system/docker.service

ExecStart=/usr/bin/dockerd -D -H tcp:// -H unix:///var/run/docker.sock
(if this fails, remove the -D)

systemctl daemon-reload
systemctl restart docker

sudo systemctl stop firewalld

sudo less /var/log/messages

netstat -an | grep 2375

Now you can connect remotely (in this case I am using localhost, but you can use an IP or a hostname if remotely connecting):

docker -H localhost:2375 info

I have tried with
export DOCKER_HOST="tcp://"
systemctl daemon-reload
systemctl restart docker

but it didn't work for me...

This allows to do cool stuff like:

curl http://localhost:2375/images/json | python -mjson.tool

One can use also the HTTP REST Api

No comments: