Docker is a combo of ‘platform as a service’ products and services which use OS virtualisation to provide software in packages called containers.
Containers contain everything an app, tool or service needs to run, including all libraries, dependencies, and configuration files. Containers are also isolated from each other (and the underlying host system), but can communicate through pre-defined channels.
This introduction to Docker video gives a quick top-level overview of the tech, how it works, and how it’s come to be so useful to millions of developers:
Better yet, Docker is open source software. It’s free to use, install, adapt, extend, hack, and build on.
In this guide, I walk through how to install Docker on Ubuntu 20.04 LTS and later:
- How to install Docker from the Ubuntu repository
- How to start Docker at system boot
- How to install Docker images (and run them)
But this guide is not a deep dive into the tech touching on everything it can do. Instead, it’s a short to help you get up and running — you take it from there.
Installing Docker on Ubuntu is Easy
To Install Docker on Ubuntu you need:
- You need to
sudoaccess - You need an internet connection
Yeah, I know; they sound obvious.
But if you want to add to Docker to an Ubuntu Server installation you may want to doublecheck anyway.
Step 1: Install Docker on Ubuntu from the Ubuntu repository. Do this using the apt command and the docker.io package name (note: the package name is not ‘docker’):
sudo apt install docker.io
This downloads the latest version of Docker from the Ubuntu repositories, unpacks it, and then installs it on your system where you can run it from the command line.
Step 2: To start Docker automatically on boot run this command:
sudo systemctl enable --now docker
Step 3: Start testing things!
Once Docker is installed and running you can verify everything is working. How? By runnng the hello-world app from the command-line, like so:
sudo docker run hello-world
When you run this command you’ll see a lengthy message informing you that the ‘installation appears to be working correctly’.
But look closely at the message:
Notice something interesting near the start? It says “Docker was ‘unable to find’ the a ‘hello-world’ image”, yet instead of erroring out it instead searched for and downloaded the ‘hello-world’ image from Docker Hub.
Which leads us neatly on to…
Step 4: Find and install Docker images.
Now you’re set-up, the world (well, the Docker ecosystem) is your oyster, and Docker Hub is your main port of call.
Docker Hub is billed as ‘the world’s largest library and community for container images’. Any image available on Docker Hub can be installed on your system too.
Let’s look at how to do that.
To search for an image on Docker Hub run the docker command with the search subcommand, like so:
sudo docker search term-goes-here
For example, I want to search for Alpine Linux on Docker Hub so I run docker search alpine. A list of matching images (which match the term alpine) will appear. I want the official Alpine image so I look in the OFFICIAL column for the word OK
When you find the image you want to use you can download it using the pull subcommand, For example, to install Alpine Linux I run sudo docker pull alpine.
To run a downloaded image you need to add the run subcommand and the name of the image, e.g., sudo docker run alpine.
If you want to run an image as a container and get instant ‘interactive terminal’ shell access add the -it flag. For example: I run sudo docker run -it alpine and it drops me straight into the Alpine container, ready to work:
To exit the ‘interactive terminal’ type the word exit and hit enter.
Check out the Docker Docs page for a wealth more info on how to use, admin, manage, and maintain your containers.
A couple of useful commands to know include docker ps -a to list all images you’ve used (and see their container ID/name); docker stop {container id} to close an image down; and when you’re done with a container remove it using the docker rm command, again adding the the container ID/name at the end.
Going Further
As I said: my aim was to walk you through installing Docker on Ubuntu, setting it to run at boot, and how to find and install official images.
The next steps are down to you. Docker is versatile, powerful technology that can do some impressive (and some rather more basic) things.
One possible avenue to explore is installing Docker rootless. This is an experimental feature and not (yet) easy to enable. But the effort required to set it up is worth it if you’re concerned about security and stability.
If there are topics you want to see a similar to-the-point tutorial on (be it Docker related or otherwise) do drop a note down in the comments or via my usual e-mail.


