Sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io Check Install. Install Docker Compose. To upgrade Docker Engine, first run sudo apt-get update, then follow the installation instructions, choosing the new version you want to install. Install from a package If you cannot use Docker’s repository to install Docker Engine, you can download the.deb file for your release and install it manually.
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
&& How to install Ansible on Ubuntu
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.
If you think we helped you or just want to support us, please consider these:-
Connect to us: FacebookTwitter
Pick Your Operating System
You came here to ask, 'how do I install Docker?' The answer can be straightforward if you're willing to accept my way, but the steps differ based on which operating system is utilized. To make things more complicated, there are a few ways to install Docker on your OS that are largely based on preference. Today I'm going to walk you through my preferred method. This isn't the only way, but I've found it to be the best way to get up and running with ease. For Ubuntu, we'll be setting up the Docker Engine. For Windows and macOS, we'll be using Docker Desktop.
Click on any of the links below to get started with installing Docker.
Installing Docker on Ubuntu
For Ubuntu, we're going to install Docker Engine and Docker Compose using the Docker and Compose repositories. This also happens to be the recommended approach by Docker.
- Delete any prior versions if you had installed them.
- Update your system and install the necessary dependencies.
- For security purposes, add Docker's official GPG key. Read more about that here.
- Set up the stable repository.
That's quite a few steps, but if you followed along exactly, you should be ready to install Docker!
- Install the latest version of Docker, along with its dependencies.
- Verify your install by running your first image.
- Add your user as an admin to the Docker user group.
Doing this last step means you no longer have to append
sudo to run Docker commands!
Fed up with Docker on your Ubuntu box? Uninstall and remove the configuration files with the following commands.
Installing Docker Compose on Ubuntu
You must have completed the installation of Docker Engine in the steps above before you can install Docker Compose. Assuming you've done so without any errors, let's continue on!
- Download the stable release of Docker compose.
Unlike the installation for Docker Engine where it automatically installs the latest version, Docker Compose has to have the version manually specified. At the time of writing, the latest version is
1.29.2. The latest version can be viewed at the Compose repository release page on GitHub. Feel free to substitute the version in the command above as needed.
- Make the downloaded binary executable.
To remove Docker Compose, utilize the following command (assuming you installed with
curl as we did above).
Installing Docker Desktop on macOS
Note that Docker Desktop comes pre-equipped with Docker Engine, Docker Compose, Kubernetes, and a few other goodies.
Intel or Apple Silicon
Depending on which chipset you have on your Mac, you'll need to install one of two versions of the Docker Desktop application. As this is a GUI application, there's not much needed other than navigating to the correct site and installing the .dmg file. Just drag and drop the Docker icon into your
Docker for macOS with Intel
The official link for installing Docker Desktop for macOS with an Intel chipset can be found here.
We'll also need to take a few prior steps to get Docker Desktop running with Apple Silicon. Namely, you'll need to install Rosetta 2 with the following command.
Afterward, install Docker Desktop for macOS with an Apple Silicon chipset from here.
Sudo Apt Install Docker.io Ubuntu
Within the Docker Desktop toolbar item, navigate to the menu >
Uninstall. See the screenshot below.
Installing Docker Desktop on Windows and WSL2
Note that Docker Desktop comes pre-equipped with Docker Engine, Docker Compose, Kubernetes, and a few other goodies. Firstly, you will need Docker Desktop even if you want Docker to only run on WSL. This is due to the sandboxed nature of WSL.
- First, you'll need to ensure that virtualization is enabled for your CPU in the BIOS. This differs amongst motherboard manufacturers and chipsets (namely Intel and AMD). A quick Google search will get you going though.
- The executable for Docker Desktop for Windows can be found here. It can also be found on Docker Hub. Click the installer, follow the prompts and wait for it to be downloaded.
Sudo Apt Install Docker
- During the process, be sure to allow the prompts for
Enable Hyper-V Windows Featuresand the
Install required Windows components for WSL 2.
You'll need to complete the steps for installing Docker Desktop on Windows before you can utilize WSL2. However, once you've completed it, feel free to come back to this section.
Use the WSL2 based enginein the Docker Desktop for Windows settings and
Apply & Restart.
- Be sure that WSL2 is set as your default and current distribution.
Check the current WSL mode.
If not set to v2, upgrade your existing Linux.
Set v2 as the default version.
- Navigate to
WSL Integrationand make sure
Enable Integration with my default WSL distrois checked.
Docker Desktop can be uninstalled from the Apps & features system settings. Just search for
Docker Desktop and select
Uninstall. Follow the prompts.
More Questions or Need Help
Sudo Apt Install Docker-compose
Be sure to check out the official documentation for Docker Engine and Docker Desktop and if you have more questions, feel free to send a message with any of the media icons below!
Comments are closed.