This lesson is in the early stages of development (Alpha version)

Using Containers in Science (Docker and Singularity)

Key Points

  • A container is a set of processes that are isolated from the rest of the system.

  • A container provides all files necessary to support the processes

  • The one big difference between containers and VMs is that containers share the host system’s kernel with other containers.

  • Containers simplify the way how to ship, build and run applications.

Pulling and Running Docker Containers
  • Use docker pull to fetch images from a Docker registry and to save them locally.

  • docker run creates a container from a Docker image and runs a command inside.

  • Use the option -v with the docker run command to mount a local folder into the docker container.

  • To cleanup leftover containers use the command docker rm.

Creating a Docker container
  • A Dockerfile is a text file containing instructions for building a Docker image.

  • Use the command docker build to build an image from a Dockerfile.

  • Specify your bild instruction in a file called Dockerfile.

Publishing Docker Images to a Container Registry
  • Pushing Docker images.

  • Tagging Docker images.

  • Deleting Docker images or tags.

Using Docker Compose
  • Using Docker Compose makes developing and using dockerized applications easier most of the time

  • Use a docker-compose.yml to configure your container(s)

  • Use docker-compose up -d to start your container(s)

  • Use docker-compose down to stop your container(s)

Using Tools to Manage Docker Containers
  • Tools which help to understand complex systems

Using Containers in HPC with Singularity
  • Use the singularity run command to run a Singularity image.

  • Define the construction manual of a Singularity image in a definitions file.

  • Singularity is more often available in HPC systems.

Pitfalls and Best Practices
Package your own application into a container