Docker: Difference between revisions

From Grid5000
Jump to navigation Jump to search
Line 44: Line 44:
{{Term|location=node1|cmd=<code class="command">docker pull</code> <code>centos:7</code>}}
{{Term|location=node1|cmd=<code class="command">docker pull</code> <code>centos:7</code>}}
{{Term|location=node1|cmd=<code class="command">docker save</code> <code>-o ~/centos7.tar centos:7</code>}}
{{Term|location=node1|cmd=<code class="command">docker save</code> <code>-o ~/centos7.tar centos:7</code>}}
{{Term|location=node2|cmd=<code class="command">docker load</code> <code>~/centos7.tar</code>}}
{{Term|location=node2|cmd=<code class="command">docker load</code> <code>-i ~/centos7.tar</code>}}


Example with a Swarm:
Example with a Swarm:

Revision as of 14:07, 14 November 2017


Docker is a software technology that provides operating-system-level virtualization. In this page, we present some tools that are specifically designed to use Docker on Grid'5000.

Installing Docker from a node

You can install and use Docker from a node with the standard environment by following these instructions:

Reserve a node
Terminal.png fnancy:
oarsub -I

(you can also use option -t deploy and Kadeploy if you prefer)

Install Docker

The script g5k-setup-docker, available from the standard environment, installs Docker locally. Option -c makes docker command available without needing to log out and reconnect to the node

Terminal.png node:
g5k-setup-docker -c
Run Docker

You can now check that Docker is up and running

Terminal.png node:
docker run hello-world

Using docker-machine and docker-g5k

The Spirals Team in Lille developped two tools to ease Docker usage on Grid'5000:

  • a docker-machine driver
  • the docker-g5k program
Provision a node with docker-machine

The driver for docker-machine allows you to reserve a node on Grid'5000 and to install a Linux image and Docker Engine on it, from your computer and in one single command. The reserved node is then available from commands like docker-machine ssh (standard ssh commands don't work when nodes are reserved with docker-machine).

Create a Swarm with docker-g5k

The docker-g5k program allows you to reserve several nodes, possibly on different sites, and to install a Linux image and Docker Engine on each node, in one single command. This command configures a Swarm, i.e. a set of Docker containers distributed over several nodes that communicate with each other.

Managing Docker images

Users sometimes want to load Docker images quickly or store private Docker images in a registry. Achieving these goals is not easy, because Grid'5000 network connection to the outside has poor performance (<1Gbps). However, we propose the following solutions to manage your images.

Use docker load/save

To load and save images quickly, we encourage you to use docker load and docker save commands, with .tar docker images stored in your Grid'5000 home. User's home are NFS mounted in all nodes deployed with the standard environment, with good network performance.

Example with 2 nodes:

Terminal.png node1:
docker pull centos:7
Terminal.png node1:
docker save -o ~/centos7.tar centos:7
Terminal.png node2:
docker load -i ~/centos7.tar

Example with a Swarm:

Use Inria private registry

Inria members can store private Docker images at Inria private registry (also look at the documentation), but network throughput is low.

Use a persistent VM

If you want to benefit from a private registry with good network performance, and are ready to manually install your own registry, you can request a Persistent Virtual Machine. You can look at Harbor or Portus open source projects, in order to install your own registry.