After installing Docker on CentOS we need to Docker remote API port on CentOS.
$ cat /etc/sysconfig/docker other_args=""
Edit the file /etc/sysconfig/docker as below.
other_args="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock"
After that, restart docker and try to access the host from another host.
$ sudo /etc/init.d/docker restart ... $ curl $hostname:4243/images/json ...
For a systemd based Distro like Centos7
Linux with systemd (Ubuntu 15.04, Debian 8,…)
Using systemd, we’ll need to enable a systemd socket to access the Docker remote API:
Create a new systemd config file called /etc/systemd/system/docker-tcp.socket to make docker available on a TCP socket on port 2375.
[Unit] Description=Docker HTTP Socket for the API [Socket] ListenStream=2375 BindIPv6Only=both Service=docker.service [Install] WantedBy=sockets.target Register the new systemd http socket and restart docker systemctl enable docker-tcp.socket systemctl stop docker systemctl start docker-tcp.socket
Open your browser and verify you can connect to http://localhost:2375/_ping
