Appendix: Using Docker for Compute NodesΒΆ

Scyld ClusterWare also supports Docker, which is available from CentOS.

The following example shows Docker being used to execute the pre-built Docker "Hello World" image. First preferably create a new image:

# Clone a new image instead of modifying an existing image.
scyld-imgctl -i DefaultImage clone name=DockerImage

# Install needed packages inside the new image.
# NOTE: This uses the default _boot_style=rwram and _boot_rw_layer=overlayfs
scyld-modimg -i DockerImage --freshen --overwrite --no-discard \
             --install docker --exec "systemctl enable docker" --upload

Alternatively, the administrator may choose to use a _boot_style of roram or iscsi for nodes using this DockerImage. To accomplish this, more must be done to the DockerImage image and to all the nodes that use that image. For example:

# Additionally create file /etc/rwtab.d/docker in the image.
scyld-modimg -i DockerImage --freshen --overwrite --no-discard \
             --install docker --exec "systemctl enable docker" \
             --exec "echo 'empty /var/lib/docker' >/etc/rwtab.d/docker" --upload

scyld-nodectl -i <NODES> set _boot_style=roram _boot_rw_layer=rwtab
# Or use scyld-attribctl if the <NODES> are in a group.

You will also need to set up IP forwarding on the head node(s) for the node to access the external Internet, which may likely involve using scyld-modimg to add appropriate nameserver entries to the node's /etc/resolv.conf. See Configure IP Forwarding for details.

Now boot node n0 with the new DockerImage:

scyld-bootctl -i DefaultBoot clone name=DockerBoot
scyld-bootctl -i DockerBoot update image=DockerImage
scyld-nodectl -i n0 set _boot_config=DockerBoot
# Now reboot node n0
scyld-nodectl -i n0 reboot

When node n0 is up, you can initialize passphrase-less key-based access, as described in OpenMPI, MPICH, and/or MVAPICH, to allow your current administrator userid to ssh to the node, or you can simply login as root:

sudo ssh n0

# Now as user root on n0, and if n0 can access external Internet websites:

[root@n0] docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ...
latest: Pulling from docker.io/library/hello-world
1b930d010525: Pull complete
Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8
Status: Downloaded newer image for docker.io/hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Note the Hello from Docker! line in the above output.