Install Docker on Ubuntu using Script
This tutorial explains, how to install docker on Ubuntu.
Docker is a platform that combines applications and its dependencies in the form of packages called a container. We can run multiple containers on a single Operating System. Containers are not Virtual Machines. Virtual Machines requires Operating System to run applications, but containers do not. As containers don’t need an Operating System, it takes very little time to start and hence it is very faster than Virtual Machines.
Read About: How to Install Docker on Windows
Install Docker on Ubuntu
Step 1- Update your Ubuntu Linux Box.
$ sudo apt-get update -y
Step 2 – Download and run a get-docker.sh script to install docker.
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
or you can Download and run Test Script.
Download and run testing version, download and install test-docker.sh script using the following commands.
$ curl -fsSL https://get.docker.com -o test-docker.sh
$ sudo sh test-docker.sh
Step 3- Add a user to the Docker group.
If you would like to use Docker with a non-root user, using the following command.
Add a new user docker-user and set a password
$ sudo useradd docker-user
$ sudo passwd docker-user
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Add docker-user to Docker group
$ sudo usermod -aG docker docker-user
Step 4 – Check Docker Version
Check Docker Version using the following command
$ docker – -version
Docker version 19.03.8, build afacb8b7f0
Uninstall Docker on Ubuntu
Use the following command to uninstall docker completely, including Docker Engine, CLI and Containerd Package
$ sudo apt-get purge docker-ce docker-ce-cli containerd.io -y
Also delete all Docker Images, Containers, and Volumes that not automatically remove.
$ sudo rm -rf /var/lib/docker
Note: If you install docker using the script, you should update the docker using the package manager only. Don’t re-run docker script, as it can cause issues if it attempts to re-add repositories.
I hope you enjoyed this tutorial and learned about “How to install Docker on Ubuntu using Script”. If you think this is really helpful, please do share this article with others as well. Please also share your valuable feedback, comment, or any query in the comment box. I will really happy to resolve your all queries any.