Docker Community Forums

Share and learn in the Docker community.

Expose the Docker Remote API on Centos 7?

Hi, I am struggling since 3 days to acheive, something simple according to docs but it seems it is not the case.
I need to access my docker on Centos7 remotely on port 2375. I did all what is recommended on all threads I can find on earth but it is not working. on a thread I opened yesterday mistakenly on docker for windows forum #318, again received the same exact response asking me to issue

dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock

It appears that there is no dockerd on Centos, the command gives the following error:

sudo: dockerd: command not found

This morning I found a thread at http://stackoverflow.com/questions/40242522/how-do-i-expose-the-docker-remote-api-on-centos-7
indicating that a .conf file needs to be created at

/etc/systemd/system/docker.service.d/docker-external.conf
which absolutly has no impact

Can you please help and indicate the steps to follow for Centos7 or point us to any appropriate document that allow invocation via the Remote API?
It seems that somebody has asked the same thing since June, still until now no clear response at
https://forums.docker.com/t/cannot-control-port-exposure-via-docker-remote-api-from-node/16777/2

Thanks in advance

Hi

Did you follow the Docker install instructions from here: https://docs.docker.com/engine/installation/linux/centos/ ?

dockerd should be added to the standard /usr/bin path on CentOS 7. Check to see that it is there (ls /usr/bin/dockerd) - if it is, make sure your path settings are correct. If it’s not, docker hasn’t correctly installed and you might want to try again.

Once you get that figured out, the command you list should expose the remote api. In CentOS 7, the init system is systemd, so you might want to create the following folder/file location with the desired docker exec command:

/etc/systemd/system/docker.service.d/docker.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock

Restart the docker service using systemd commands:

sudo systemctl daemon-reload
sudo systemctl restart docker

You can confirm that the exec took your override parameters by calling:

ps -ef | grep docker

Look for the dockerd process and confirm that your -H settings are listed.

Now, you should be able to hook up to the api: >docker -H :2375 info

1 Like

Hi,
Yes I followed instructions at the url sevral montrhs ago and I had a I think verion 1.2…
I have upgraded to version 1.10.3 4 days ago using

yum upgrade docker

I checked usr/bin, no dockerd file, I have only

docker Program
docker-current Program
docker-storage-setup Program