Install and Use Docker on Ubuntu 20.04
Docker is open source software for generating and managing containers that contain a single application’s runtime environment as well as everything it requires to run. Docker is frequently used in the DevOps process of continuous software development, testing, and deployment.
You need connect the Docker developers’ repository to install and stay up to date with the current version. Update the repository and install the required packages first.
$ sudo apt update $ sudo apt install software-properties-common ca-certificates curl gnupg-agent apt-transport-https
By adding this key, you’re preparing the system to accept a repository.
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the repository itself to the list.
$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
The system will be ready for installation after you run this command. Let’s get started.
$ sudo apt update $ sudo apt install docker-ce docker-ce-cli containerd.io
The installation is finished at this stage. Let’s have a look at some options and run a test container.
Privileges for Docker
The user must have sudo rights to manage Docker and run commands in it. Add another user to the docker group if you wish to give him sudo rights in Docker. But be cautious! This group’s members have root access to the Docker host. Replace user with the needed username when running this command.
$ sudo usermod -aG docker user
Using Docker to Run a Test Container
A test container can be used to see if Docker is capable of running containers.
$ docker container run hello-world
After the image has been loaded, you will get a notice stating that the container has been successfully launched.
Follow us Twitter, Facebook, LinkedIn
Leave a Reply