Jump to navigation Jump to search

Docker set up and install between multiple hosts. References on the bottom of this wiki page.

For simplicity there is an assumption of two hosts but there can certainly be more than one remote host. More on this later.

Install Docker on Both hosts:

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo
yum install docker-ce docker-ce-cli

Edit the remote docker service to listen on the IP instead of the socket. ( Do this on every remote server you desire to connect to )

systemctl edit docker
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://<ip>:2375

Restart the Docker daemon and test for the prescense of port 2375.

netstat -lnputo:

Firewall rules for the remote host:

firewall-cmd --add-port=2375/tcp --add-port=4789/udp --add-port=7946/tcp --add-port=7946/udp --permanent
systemctl restart firewalld

From the calling host:

Place the following into your .bashrc and source it.

export DOCKER_HOST="tcp://"

Or use:

docker -H tcp://<ip>:2375 <Commands>

Don't forget to make sure the daemons restart on bootup!

Reference for each component mentioned above:

Install on Both hosts:

Remote Daemon Config:

Calling Host Syntax and config:

Firewalld Ports to open:

Todo: Ansible Playbook that turns any Centos / RHEL box into a remote Docker Daemon