docker
Devops

How to install docker on Ubuntu 22.04

Docker is an open source container platform that makes it easy to create, deploy and run applications in software containers.

In this article we will discover how to install Docker on Ubuntu 22.04

Installation Steps

– Step 1: First, make sure that no version of Docker is installed on your system. To check this, type the command below to remove the running Docker files:

Linux@Ubuntu:~$ sudo apt-get remove docker docker-engine docker.io

– Step 2 : Update the system with the following command :

Linux@Ubuntu:~$ sudo apt update -y

If there are packages to upgrade, you will get a message like the one below :

Fetched 3,940 kB in 1s (3,071 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
135 packages can be upgraded. Run 'apt list --upgradable' to see them.

If this is the case for you, type the following command to update them :

Linux@Ubuntu:~$ sudo apt upgrade -y

– Step 3 :Next, install Docker :

Linux@Ubuntu:~$ sudo apt install docker.io

Step 4 : Check the installed docker version :

Linux@Ubuntu:~$ docker --version

Testing Docker :

To test if Docker is working properly, do a pull of the docker image from docker Hub with the following command :

Linux@Ubuntu:~$ sudo docker run hello-world
[sudo] password for linux:

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

If you have the same result as mine, it means that Docker is working properly.

Congratulations, you have successfully installed Docker.

To read this article in French, Click here.

You might also like

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *