How To Install Docker On Ubuntu Machine

In this post, we will walk through the process of installing Docker on an Ubuntu machine. Follow these steps to get Docker up and running on your Ubuntu system.

Refer : https://docs.docker.com/engine/install/ubuntu/

1. Update the system package index

sudo apt-get update

2. Install necessary packages

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release

3. Add Docker’s official GPG Key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

4. Check your system architecture

sumit@splunk:~$ uname -m
x86_64
sumit@splunk:~$

5. Add the Docker repository for your system architecture

echo \
“deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

6. Update the package index again and install Docker

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

7. Verify the installation by running the ‘hello-world’ container

sumit@splunk:~$ sudo docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:9f6ad537c5132bcce57f7a0a20e317228d382c3cd61edae14650eec68b2b345c
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/

sumit@splunk:~$

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s