Share this page:

Container-based Execution Environments

The use and execution of code can place complex requirements on the execution environment. Code Notebooks are already a simple way of encapsulating an execution environment. But they can reach their limits when there are very individual requirements for the operating system, pre-installed software or required programme libraries. You can then use so-called container technologies.

Generally speaking, container technologies provide an isolated execution environment with everything needed to run an application. A container has an effect as an operating system of its own, but shares resources with the so-called host operating system. In simple terms, this means that only Windows containers can run on Windows and only Linux containers on Linux. Containers are portable and can therefore be shared. They therefore offer a good opportunity to package your code and all dependencies – also in terms of reproducibility.

The best-known container platform is Docker. The components of Docker are mostly Open Source and free for private use. There are also paid features and offers for teams and companies.

Docker enables the creation, execution and management of containers. A text file called “Dockerfile” is used to specify instructions for creating an executable Docker image (container). Docker offers its own service, Docker Hub, for managing and sharing created Docker images.

Container technologies such as Docker require corresponding software environments to create and execute a container image. Docker Desktop is an easy-to-install environment with a graphical user interface. If you do not want to or cannot install this locally, there are often cloud environments available for Docker. However, Docker currently only offers a commercial enterprise solution, which is aimed more at companies. The images can also be run in cloud environments from Google and Amazon.

Docker is widely used in science. Dockerfiles can also be linked, managed and shared as text files on GitHub, for example. Docker images can be shared on Docker Hub. Journals of the American Economic Association (AEA) also accept Docker images so that your research can be checked for reproducibility. To make it easier to get started, you can also use Dockerfiles from the AEA, which are provided via GitHub. You can use these Dockerfiles, for example, to create Docker images for a rudimentary R and Stata environment and continue working with them. Further Dockerfiles or even Docker images that have already been created are made available for subsequent use via the Rocker Project for various use cases.

Tip: A good introduction to containers and Docker can be found at “The Turing Way“.