Running a container in Docker is done by executing a series of commands which starts a group of processes, which the tool isolates from the rest of the system.
Docker can be used to run a single process, but in practice we want to run a full Linux distribution. Not to worry, everything needed to run a full Linux inside Docker is already available.
Every existing Linux distribution out there provides a base image, which lets you run the distribution in Docker. The typical way you use images is by creating a Dockerfile
(https://docs.docker.com/engine/reference/builder/), where you point the base image you want to use, and add some extra commands to be run to create the container.
The following is a basic example of a Docker file:
FROM ubuntu RUN apt-get update && apt-get install -y python CMD ["bash"]
A Dockerfile
is a text file with a set of instructions. Each line starts with the instruction in uppercase, followed by its arguments.
In our example, there are these three instructions...