Installing Docker On Ubuntu 23.04

Hello,
In this week’s feature highlight, we look at How to Install Docker On Ubuntu 23.04

What is docker?

Docker is basically a container engine which uses the Linux Kernel in order to create the containers on top of an operating system. Which is used to create, deploy and run the applications.

Install Docker

Install the docker using the apt package manager.

apt install docker.io

Start and enable docker

systemctl enable --now docker

Check Docker service status

systemctl status docker

Output:

root@ubuntu:~# systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; preset: enabl>
     Active: active (running) since Fri 2023-04-21 20:31:43 UTC; 23s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 3809 (dockerd)
      Tasks: 9
     Memory: 22.8M
        CPU: 1.359s
     CGroup: /system.slice/docker.service
             └─3809 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/cont>

Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.322853594Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.323411858Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.323809254Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.392873225Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.741850321Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.960585254Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.996881239Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.997602672Z" lev>
Apr 21 20:31:43 ubuntu systemd[1]: Started docker.service - Docker Application >
Apr 21 20:31:43 ubuntu dockerd[3809]: time="2023-04-21T20:31:43.091542255Z" lev>

Create a group called docker,

groupadd docker

To add an user into the docker user group

usermod -aG docker $USER

If you want to add a different user, replace $USER with existing username.

Check docker version,

docker --version

Ouput:

root@ubuntu:~# docker --version
Docker version 20.10.21, build 20.10.21-0ubuntu3

Test docker using the hello-world container.

docker run hello-world

Output:

root@ubuntu:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:4e83453afed1b4fa1a3500525091dbfca6ce1e66903fd4c01ff015dbcb1ba33e
Status: Downloaded newer image for hello-world:latest

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/
(Visited 421 times, 1 visits today)