Skip to content

Docker, a quick introduction

Abby Drury edited this page Apr 4, 2023 · 4 revisions

This project requires you to install Docker, and uses Docker Compose.

Please ensure that your version of Docker includes Docker Compose version 2.0+. If you have a recentish version of Docker, you probably already do. You can check this by running docker compose version.

Very basic Docker level-setting

Docker is a technology that bundles a software program with all of the other software that application needs to run, such as an operating system, third-party software libraries, etc (hat tip: Simple Wikipedia).

A Docker service is provided by one or more Docker containers that run some application code. A Docker container is created based on a Docker image.

What?

When this document refers to the "container", it means "the instance of JupyterLab that is running in Docker on your computer/host machine".

The concept of a Docker image is a little bit more complicated, but it's basically a blueprint that Docker uses when instantiating/creating a container. An image is typically defined in a file called Dockerfile. A Dockerfile can begin by including another image as its base that it then extends to add additional functionality (ours does this).

The Dockerfile can be further configured by adding another file to enable the docker compose tool, which is typically named compose.yml.

docker compose is a tool that is (now) included with a basic Docker installation that provides some additional scaffolding around the base docker commands to make things a little easier to deal with.

You can find out more about the specific files in the environment files for the project.

But you also mentioned Docker services earlier, what are those?

There is another thing called a Docker service. We have a pretty simple Docker use-case (in that we're probably not going to need highly scalable deployment), so we will probably run a single service that runs in a single container that is based on a single image.

You can understand services and containers as basically identical for now.

But what are they?

You could use Docker Swarm/Kubernetes/etc to run multiple Docker containers that all use the same Docker image -- together, those containers each provide distributed access to a Docker service. This means that in a Swarm/Kubernetes installation, a single service could have multiple containers handling requests in parallel. The collections of identical containers have different names in Swarm and Kubernetes ("pods", "swarms", etc).

Kubernetes and Docker Swarm are ways to orchestrate your containers and they automagically manage request loads and spin up/cull containers and their associated resources as needed.

However, that level of complexity is likely unnecessary for this use.

Resourcing Docker

You decide how much of your computer's resources (CPU, RAM, etc) are available to Docker. If you have Docker Desktop installed, you can adjust these limits in the Preferences, under Resources > Advanced.

You’ll need to consider how your own computer is resourced when you choose values. For reference, here is an example configuration. It shows 5 CPUs, 8.00 GB of RAM, and 4.00 GB of swap space. Docker Desktop resource limits