Docker is an open-source platform that allows developers to build, ship, and run applications in containers.
Docker containers are portable, meaning they can run consistently across different operating systems and environments (development, testing, production). This eliminates the "works on my machine" issue, ensuring applications behave predictably regardless of the underlying infrastructure.
In this post we will discuss how to install docker on ubuntu operating systems or on ubuntu virtual machines.
so without further delay, let's start.
The first method is :-
power on your ubuntu system or launch ubuntu virtual machine on
Azure or AWS or GCP .Open terminal if you are in GUI mode or for virtual machines "ssh" into the virtual machines.
Take the root user privilege with the help of following command
Update the local packages
Run the following command
Above command downloads the script get-docker.sh to your local system/virtual machine from https://get.docker.com/To install the above script (get-docker.sh) run the following command
The get-docker.sh installs the latest stable release of Docker on LinuxEnable docker services
Check the status of docker service if it is running or not
The above command shows the following output of docker is running
and it is showing in green that docker service is active and running.Start the docker daemon
To check docker service run the following command
The above command pulls the image "hello-world" from docker hub to your local system/virtual machine executes it and throws a hello message.
The out put is as follows.
The second method is :-
power on your ubuntu system or launch ubuntu virtual machine on
Azure or AWS or GCP .Open terminal if you are in GUI mode or for virtual machines "ssh" into the virtual machines.
Take the root user privilege with the help of following command
Update the local packages
Install docker
Enable docker services
Check the status of docker service if it is running or not
The above command shows the following output of docker is running
and it is showing in green that docker service is active and running.Start the docker daemon
To check docker service run the following command
The above command pulls the image "hello-world" from docker hub to your local system/virtual machine executes it and throws a hello message.
The out put is as follows.
Finally you are ready to work with docker.
Note:- although The docker service starts automatically on Debian based distributions but it is advisable the check the services by using systemctl command as shown in this article.