Software Containers¶
Why Using a Software Container?
A simple and lightweight solution to reproducible science; see "An introduction to Docker for reproducible research" (paper/pre-print)
KRG Use Cases
- Tutorials
- GitLab CI/CD
- Distribution of pre-release software
- Reproducers of published works
Docker¶
Level 1: Using Images¶
You will need to add sudo
prior to docker
when using Ubuntu
Since docker runs as root
(super user), you may need to run sudo docker
instead of docker
on some operating systems.
- install docker engine
- run container by (
docker run -it <img>
) using a given docker image (<img>
, which can be replaced by, e.g., one of the containers of our group):
- one can also share files between the host (your operating system) and the guest (docker image) by mounting the host volume to the guest (see this thread for more information):
Project: Getting KRG Program Environment
Level 2: Building and Managing Images¶
Build a Docker Image to Dockerhub:
login (one-time) to host and build an image
sudo docker login [registry_host] # when [registry_host] is absent it is assumed to be Dockerhub; you will be prompt for username and password(/token)
sudo docker build -t [registry_host/]<container-tag> . # build from "Dockerfile" in the current directory
sudo docker push [registry_host/]<container-tag>
an example
managing images
- get images from remote
registry_host
: - show existing images
- remove an image
Other containers exist to address problems of docker
While docker has limitations, it provides a good starting point for building containers. Docker containers that are compliant to the Open Container Initiative can be used with other container technologies (e.g., singularity
) to sidestep limitations.
Additional Tutorials
- Introduction to Docker (by Matthew Feickert)
- Docker Tutorial for Beginners (video)
- How to Build Docker Images
work with local file system
Level 3: More Advance Topics¶
Using (Private) GitLab Container Registry
- setup a token on GitLab for
read_registry
andwrite_registry
process handling
HPC-Centric Containers
- Singularity a Container for HPC
- NERSC Shifter
- podman