Docker images
Running containers on nodes¶
Besides loading a regular image on a node, you can have it run a docker
container instead. This is what the rhubarbe docker subcommand is about:
it loads on the node a special image that has docker installed (the host
image), and then pulls and runs the container of your choice on top of it.
Like the other rhubarbe commands, it is available on the gateway, and it
needs a valid lease on the nodes.
rhubarbe docker --helpUsage: rhubarbe docker [OPTIONS] COMMAND [ARGS]...
Run user containers on nodes loaded with a docker-enabled image.
Options:
-h, --help Show this message and exit.
Commands:
images List the images in the private registry.
load Load the docker host image, then pull and run a container.
rmi Delete images from the private registry; reserved to root.
save Commit the container on a node and push it to the registry.
url Print the URL of the registry API, for crafting requests.In the next tabs, we see which images are available, how to load them on nodes, and how to save your own.
Which container images can I use ?¶
There are two families of images.
Globally available images, from public registries like Docker Hub or quay.io: for example
ubuntu,fedora:latest,debian:trixieorquay.io/centos/centos:stream9. Docker Hub is reached through a cache run by the testbed, so the popular images are quick to pull.Local images, that are stored in the registry of the testbed,
registry.pl.sophia.inria.fr. This is where the images go when you save them yourself, in ther2labnamespace of that registry.
The images subcommand lists the local ones
rhubarbe docker imagesIt prints the references as registry/name:tag, so that you can paste them as is
in the -i option of load. You can narrow the search by giving a part of the
name
rhubarbe docker images ubuntuUse -a to also see the images of the registry that are outside of the
r2lab namespace. With -m, you get instead the list of the Docker Hub
images that are already in the cache, and thus the quickest to pull.
Loading a container on nodes¶
Just like rload for regular images, rhubarbe docker load acts on your selected
nodes, or on the nodes that you list. The -i option names the container image
to run.
A global image
rhubarbe docker load -i ubuntu 12-15
rhubarbe docker load -i quay.io/centos/centos:stream9 12-15A local image, from the registry of the testbed
rhubarbe docker load -i registry.pl.sophia.inria.fr/r2lab/my-image 12-15The registry and the r2lab namespace can be omitted: with -i my-image, the
local registry is tried first, and if it has no such image, the name is looked up
on Docker Hub. The command tells you how it resolved the name.
What happens¶
Very roughly, for each node:
the host image is loaded on the node with frisbee, like
rloaddoes: the node reboots, and this is the longest step; the default host image has docker, and--host-image podmanselects the one with podman, based on fedora;once the node has booted, its docker engine is set up to use the local registry and the cache;
the container image is pulled;
the container is started; it shares the network of the node, so that
ssh fit12lands in the container. If the image has nosshserver, one is added to it for you; add--waitto the command to wait until you can ssh into the container.
Switching containers quickly with -k¶
If the node already runs a host image, because you have loaded one earlier, there
is no need to go through the first step again. With -k (--keep-host), the
node is not rebooted and nothing is loaded with frisbee: the container, if any, is
just replaced by the new one. That takes seconds rather than minutes.
rhubarbe docker load -k -i fedora 12-15On the website¶
On the status page of the website, a node whose host image is up, but that does not run a container yet, shows with the docker logo. Once the container is running, the node shows with the logo of the distribution of the container. The table view also has a docker column, that shows whether the container is running, and which image it runs.
Saving a container¶
You can store the container of a node in the registry of the testbed, so you can
use it again later on, or share it. Like rsave for regular images, this
applies to one node at a time. To save the container of node 12
rhubarbe docker save 12 -o my-imageThis commits the container as it is now, and pushes it as
registry.pl.sophia.inria.fr/r2lab/my-image. If that image already exists, you
are asked for confirmation before it is overwritten, unless you add -y.
You can check that it is there
rhubarbe docker images my-imageand load it later on, on any nodes
rhubarbe docker load -i my-image 13-15