Selenium 4 Grid With Docker: Install Docker on Ubuntu/Linux (Step by step)

Tutorial 28 - Selenium 4 Grid With Docker: Install Docker on Ubuntu (Linux)

What you will Learn:

  • Step#1: Set the environment for docker installation on Ubuntu

  • Step#2: Add Docker's​​ official GPG key

  • Step#3: Set up the stable repository

  • Step#4: Install docker on Ubuntu

  • Step#5: Check if docker service is running

  • Stop/Start docker service

  • docker version, docker --version, docker info commands

Step#1: Set the environment for docker installation on Ubuntu

Switch user as root, enter root password to login

Execute​​ apt-get update​​ command to update the repository list of virtual machine


Note down the ip address of VM

To easily copy/paste remaining commands, let us ssh the above ip address​​ of the VM from our windows machine. Enter superuser password to login


Switch user as root, enter root password to login

Go to official docker site​​ https://docs.docker.com/engine/install/ubuntu/​​ 

Copy the below command

Before we execute this command, let us quickly understand few terms used in this command:

So let us now paste the above command and execute. You might get below error

To​​ resolve this error, enter ‘software & updates’ in the search field as shown below

Click ‘Software & Updates’ icon that you see above.​​ 

The below comes up.​​ 

Also Check:​​ Selenium Online Training

Enter ‘Never’ and ‘Display immediately’ against the fields as seen below​​ 

Enter password (if prompted).

Power off the Virtual machine as shown below

Start Virtual machine as shown below

Once the machine is up, exit from ssh session.

Ssh again and switch as root user.

Execute same command again as shown below. We might get another error as seen below

Copy the command mentioned in the error message and execute:
dpkg --configure -a​​ 

Execute the same command again

apt-get install \

 ​​ ​​ ​​​​ apt-transport-https \

 ​​ ​​ ​​​​ ca-certificates \

 ​​ ​​ ​​​​ curl \

 ​​ ​​ ​​​​ gnupg \

 ​​ ​​ ​​​​ lsb-release

​​ This time it should be​​ success as shown below



So we are done with step 1 of setting up repository.

Step#2: Add Docker's official GPG key

Let us now move to step 2

Copy above command (this command is texted below for ready reference): ​​ 

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

Before we execute this command, let us quickly understand few terms used in this command:

Let us now paste the command and execute as shown below. You should not​​ see any error

Step#3: Set up the stable repository

Let us now copy the step 3 command:

 

echo \

 ​​​​ "deb [arch=$(dpkg --print-architecture) 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

 

Paste and execute, you should not see any errors

We are done with repository setup and we have set the environment for docker installation.

Step#4: Install docker on Ubuntu

Let us​​ now install docker engine.

Copy the above command and execute​​ 

Next copy:​​ 

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

Paste and execute



That’s it. We have completed the docker installation on Ubuntu!​​ 

Check if docker service is running

Execute​​ service docker status​​ command, notice below that the service is active​​ 

Stop docker service

We can stop docker service by executing ‘service docker stop

Notice below that service is inactive now

Start docker service

We can start docker service by executing ‘service docker start

Notice below that service is active now

docker version

This command shows the docker server and client details. See below, the docker version is 20.10.9

docker --version

docker --version​​ command shows only​​ the version info

docker info

This command lists out the detailed info w.r.t docker. Notice the number of containers and images right now


So this is how we setup docker on Ubuntu linux OS.​​ 

Thank you for reading!!!

Also Check:​​ Selenium Tutorials

Share On

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
Share on tumblr
Share on email

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Lifetime Membership Club

LIFETIME MEMBERSHIP BIG SALE - ALL LIVE COURES JUST - 7000 RS/ 99 USD
Attend All Live courses in just 7000 rs / $99 - offer ends 10th Nov 2024