Linux containers, tutorials and guides

What is a container?

To the host machine, containers are just a bunch of processes.

But inside each container, the process is isolated and cannot see the other processes.

What are the benefits of containers?

There are several benefits of container technology:

  • Standard deployment packaging - Docker provides a standard way to package applications for running in containers: the Docker image.

  • Ability to share base images - You don’t have to create container image from scratch; you can build new container images by layering your code on top of existing images. For example, many Linux distributions provide official base images which you can build on.

How do containers make it easier to run software?

Containers provide a standard way to package and deploy applications. The operations teams running the software only need to know how to run a container - they don’t need specialised knowledge or scripts to run the software that’s inside a container.

Containers provide a shared abstraction which can be understood by both developers and operations teams.

Developers can package an application and everything it needs to run in a container image. Operations teams only need to know how to run a container. They don’t need to know what’s inside.

How do you run a container?

Most people create and run containers using software from Docker. Docker provides software called Docker Engine for building and running containers.

Docker Engine includes the the docker command. To to create and run containers from your terminal, you use the docker command.

To start a container, you type docker run, followed by the image name that you wish to start a container from. This will start a new container from the image that you give.

Behind the scenes, the docker command does all the work of pulling the container image from a registry, and creating and starting a new container. To do this, it calls an API on a background process, or daemon, which does the work.

Are there alternatives to Docker?

Docker popularised container technology, but it isn’t the only option for running containers.

You can also use podman. Podman very closely matches the docker command line interface, and can pull and read Docker-formatted images. However it has a couple of big differences: it doesn’t rely on a daemon to run, and it doesn’t require root access either.