Difference between revisions of "Docker"

From Grid5000
Jump to: navigation, search
(Managing Docker images)
(Using docker-machine and docker-g5k)
Line 27: Line 27:
 
* the docker-g5k program
 
* the docker-g5k program
  
; Provision a node with docker-machine
+
== Provision a node with docker-machine ==
 
The [https://github.com/Spirals-Team/docker-machine-driver-g5k 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 [https://github.com/Spirals-Team/docker-machine-driver-g5k 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 <code>docker-machine ssh</code> (standard ssh commands don't work when nodes are reserved with docker-machine).
 
The reserved node is then available from commands like <code>docker-machine ssh</code> (standard ssh commands don't work when nodes are reserved with docker-machine).
  
; Create a Swarm with docker-g5k
+
== Create a Swarm with docker-g5k ==
 
The [https://github.com/Spirals-Team/docker-g5k 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.
 
The [https://github.com/Spirals-Team/docker-g5k 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.
 
This command configures a Swarm, i.e. a set of Docker containers distributed over several nodes that communicate with each other.

Revision as of 19:24, 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:

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

You can also use docker load command instead of retriving the image from Docker Hub, when deploying a Swarm with docker-g5k.

Give read rights to your image

Terminal.png frontend:
chmod 644 ~/centos7.tar

Deploy three Docker nodes in Nancy (activate the Grid'5000 VPN before launching this command)

Terminal.png laptop:
docker-g5k create-cluster --g5k-username "user" --g5k-password "********" --g5k-image "jessie-x64-std" --g5k-reserve-nodes "nancy:3"

Load Centos image on each node

Terminal.png laptop:
for i in {0..2}; do docker-machine ssh nancy-${i} "docker load -i /home/user/centos7.tar"; done


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.