Setup Docker Host as Worker Node

For the Worker Node with meeting the system requirements, three steps are required:

System Requirements

  • Hardware: 8c16g100g
  • Docker engine:
    • 1.10.0~1.13.0
  • aufs-tools (optional): Only required on ubuntu 14.04.

Docker Daemon Setup

Let Docker daemon listen on port 2375, and make sure Master can reach Worker Node through this port.

Ubuntu 14.04

Simple add this line into your Docker config file /etc/default/docker.

DOCKER_OPTS="$DOCKER_OPTS -H tcp:// -H unix:///var/run/docker.sock --api-cors-header='*' --default-ulimit=nofile=8192:16384 --default-ulimit=nproc=8192:16384"

Then restart the docker daemon with:

$ sudo service docker restart

Ubuntu 16.04

Update /lib/systemd/system/docker.service like

DOCKER_OPTS="$DOCKER_OPTS -H tcp:// -H unix:///var/run/docker.sock --api-cors-header='*' --default-ulimit=nofile=8192:16384 --default-ulimit=nproc=8192:16384"
ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS

Regenerate the docker service script and restart the docker engine:

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker.service

Alternatively (for all Linux distro):

This will run the docker-daemon on port 2375 as long as the system is restarted or docker-daemon is killed.

$ sudo systemctl stop docker.service
$ sudo dockerd -H tcp:// -H unix:///var/run/docker.sock --api-cors-header='*' --default-ulimit=nofile=8192:16384 --default-ulimit=nproc=8192:16384 -D &

At last, run the follow test at Master node and get OK response, to make sure it can access Worker node successfully.

[Master] $ docker -H Worker_Node_IP:2375 info


Run the following cmd to pull the necessary images and copy required artifacts.

$ make setup-worker

Firewall Setup

Make sure ip forward is enabled, you can simply run the follow command.

$ sysctl -w net.ipv4.ip_forward=1

And check the os iptables config, to make sure host ports are open (e.g., 2375, 7050~10000)

Work with MacOS

In MacOS, Docker currently provides no support to config the daemon to listen from network.

Users need to use some tools to config Docker daemon to listen at network manually, e.g., to config Docker daemon to listen on,

$ docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p bobrik/socat TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock
$ docker -H info

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.