Last Updated: 10/13/2021: The instructions have been updated for a modern version of Ubuntu. Docker support is very mainstream – as such the method for installing it is mainstream as well. This saves you from having to install keys for custom repositories before installing docker.
Step 1: Update your repository
Step 2: Install it.
sudo apt-get install -y docker.io
Note that for this example chose the simple form of installing “docker.io”. The system will locate other dependent modules to install if they are missing. (“docker, containerd, runc”). if you reference other guides they may list some of the additional modules which are will be installed.
See that was simple.
Now we get to learn how to get and maintain a docker image. One of the trickiest things I had when learning to use docker is learning when and how to keep persistent data. A sensible review of using docker will review a number of methods for dealing with a docker image. By default the image is going to revert to it’s original state when terminated. We might want to retain data from a session. We might want to SHARE data between a docker session and the host machine. Each of these methods are possible. We are going to need to know how to share or redirect ports between the host machine and the docker environment.
Note: To exit a session without terminating it.
To list the existing running containers
$docker container ls
To attach your console again back to a running container:
docker attach session x
Please see the other docker tutorials to learn more.