Tuesday, August 29, 2023

Install Docker on Linux

 

Docker


On your Linux machine (I'm using Ubuntu), check if you have docker installed by issuing the following command

docker --version

On my machine I did not find one, so we will go ahead and install the docker
Update the apt package index. Issue

sudo apt-get update

Install packages for apt to use a repository

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

Add Docker's GPG Key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Setup the stable command using the following command

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

Install Docker

sudo apt-get update

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

Once the Installation is complete, check the docker version

docker --version

Run Hello-world image by issuing following docker command

docker run hello-world

Run docker ps command to list the containers