Docker: software that includes everything needed to run an application.

Docker is a software platform for deploying applications in resource-isolated processes. Docker runs processes in isolated containers. Containers isolate applications at the process level and use the host's kernel instead of virtualizing an entire operating system. The host does not care about what is running inside the container and the container does not care about which host it is running on. In short, they are similar to virtual machines, only more resource-friendly.

In this post we'll install Docker and pull a Docker image.

Install Docker.

We install Docker from the official Docker repository to ensure we get the latest version.

First, we'll add a new package source:

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add

Second, we add the GPG key from Docker:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

Third, we update the package database with the Docker packages from the newly added repo:

sudo apt update

Make sure we are about to install from the Docker repo instead of the default Debian repo:

apt-cache policy docker-ce

Finally, we install Docker

sudo apt install docker-ce

Docker should now be installed, the daemon started, and the process enabled to start on boot. We check that it's running:

sudo systemctl status docker

The output should be similar to the following, showing that the service is active and running:

Once we have Docker installed, we can use the docker command line utility (i.e., the Docker client).

We add the user username to the docker group (by default, the docker command can only be run by the root user or by a user in the docker group):

sudo usermod -aG docker username

Now, we apply the new group membership by typing the following:

su - username

We check that our user username is now added to the docker group by typing:

id -nG

We can view system-wide information about Docker by typing:

docker info

We might want to change the root directory /var/lib/docker (i.e., the location of the Docker files) to another directory because we ran out of disk space in /var. To do this, we create the file /etc/docker/daemon.json and populate it with:

{
    "data-root": "/new/docker/root"
}

Then, we restart the daemon:

systemctl daemon-reload
systemctl restart docker

We now check that the the root directory has been updated by typing:

docker info

Install a Docker image: Ontology Development Kit (ODK) as an example:

The Ontology Development Kit (ODK) provides a Docker image that helps you in the process of creating OBO ontologies.

We download the image by typing:

docker pull obolibrary/odkfull

We check that the image has been downloaded to our server:

docker images

We check that a container ID (e3044811f2f0, in this case) is running the image obolibrary/odkfull by listing the containers that are running in our server:

docker ps

or we might want to list all the containers (i.e., the started and the stopped ones):

docker ps -a

We can remove a container (e.g. e3044811f2f0) we do not need anymore by typing:

docker rm e3044811f2f0

That's it!