How to Install and Configure Docker on Ubuntu 20.04

Create a non-root user to run your docker containers under:

adduser steve

Next, update the apt sources and install Docker:

apt install docker.io
systemctl enable —now docker

Now, add our new user to the docker user group so they can interact with the service:

usermod -aG docker steve

and finally, we’ll switch over to that user using su and confirm we can run a simple container:

su steve
docker run hello-world

That’ll print out the Docker welcome message, confirming that each step of the process succeeded. If you want to try something a little more interesting, you can boot an Ubuntu container with:

docker run -it ubuntu bash

-it tells Docker that you want to run this interactively and to assign a tty to you

Other than that, you can run pretty normal things within your Ubuntu container but keep in mine any changes you make or configuration you do won’t be persisted.