Install Docker For Ubuntu

  • Note: We are using Ubuntu EC2 instance from AWS. Steps to Install Docker on Ubuntu 20.04. SSH to your Ubuntu server and update the package registry. Ssh -i path-to-key sudo apt-get update -y.
  • Step 3: Install Docker Engine. Run this command to install Docker on Ubuntu: sudo apt-get install docker-ce docker-ce-cli containerd.io. After it completes, lets test to see if Docker is running: Type sudo systemctl is-active docker. If it returns ACTIVE, then you’ve confirmed that docker is now running.
  • Step 1) Install prerequisites packages for docker. Login to Ubuntu 20.04 /20.10 system and run the following apt commands to install docker dependencies, $ sudo apt update $ sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common.
Docker

Install Docker on Windows Subsystem for Linux v2 (Ubuntu) The Windows Subsystem for Linux v2 is available in preview for Windows 10 users. WSL2 is a substantial improvement over WSL and offers significantly faster file system performance and full system call capabilities. The “docker search” command is utilized in the Ubuntu terminal for searching any Docker image available on the Docker Hub. For instance, we will search for the “ ubuntu ” image on the Docker Hub but if you want to search for another Docker image, then specify its name where we added “ ubuntu ”.

Docker is an open-source platform for developing, testing, and running applications. Docker allows to package and run an application in container. A container is an isolated environment which contains everything needed for application to run.

This tutorial explains how to install Docker Community Edition (CE) on Ubuntu 20.04.

Prepare environment

Update the package lists using the following command:

Install package which allows to use a repository accessed via the HTTP:

Install Docker CE

Install

Download GPG key and add to a specified directory:

Add the Docker CE repository:

Install the Docker CE:

By default, root and user with sudo privileges can use Docker. During installation docker group is created. So if you want to allow to use Docker for non-root users, you can add user to the docker group.

Add current user to docker group:

To make changes to take effect, logout and login to your machine. After you’re reconnected, check Docker version:

We can use the following command to determine if Docker service is running:

Install Docker For Ubuntu 18

We can also stop, start and restart the Docker service:

Install Docker-compose For Ubuntu 18.04

Testing Docker CE

To test that Docker successfully installed, you can run the hello-world image.

The command downloads a test image, runs it in a container, prints message, and exits.

Uninstall Docker CE

If you decided to completely remove Docker CE and related dependencies, run the following command:

When it finished, remove the docker group:

During installation docker0 network interface is installed. You can remove it with command:

Install Docker On Ubuntu Windows 10

Remove GPG key and repository:

You can also remove Docker configuration, images, containers, and other related directories: