How to install docker on ubuntu20.04 LTS

How to install docker on ubuntu20.04 LTS

Zero: Uninstall old version

Older versions of Docker were called docker, docker.io, or docker-engine. If installed, uninstall them:

$ sudo apt-get remove docker docker-engine docker.io containerd runc

The Docker Engine - Community package is currently called docker-ce.

1. Set up a warehouse

Before installing Docker Engine-Community for the first time on a new host, you need to set up the Docker repository. Afterwards, you can install and update Docker from the repository.

Update the apt package index.

$ sudo apt-get update

Install apt dependency packages to obtain the repository via HTTPS:

$ sudo apt-get install \
 apt-transport-https \
 ca-certificates \
 curl \
 gnupg-agent \
 software-properties-common

Add Docker's official GPG key:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 Verify that you now have the key with the fingerprint by searching for the last 8 characters of the fingerprint.

$ sudo apt-key fingerprint 0EBFCD88
 
pub rsa4096 2017-02-22 [SCEA]
  9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <[email protected]>
sub rsa4096 2017-02-22 [S]

Use the following command to set up a stable version repository

Note: There is currently no domestic docker source for 20.04, so use the 18.04 version for now.

$ sudo add-apt-repository \
 "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
 bionic \
 stable"

2. Install Docker Engine-Community

Update the apt package index.

$ sudo apt-get update

Install the latest version of Docker Engine-Community and containerd

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

Three: Test

enter

$ sudo docker run hello-world

If Docker greets you - or output similar to the following appears

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
Status: Downloaded newer image for hello-world:latest


Hello from Docker!
This message shows that your installation appears to be working correctly.


To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 (amd64)
 3. The Docker daemon creates a new container from that image which runs the
 executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
 to your terminal.


To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash


Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/


For more examples and ideas, visit:
 https://docs.docker.com/get-started/

That means the installation is complete.

4. No sudo required & image acceleration

No sudo required

Refer to the following method to add users to the docke group

$ sudo usermod -aG docker [your username]

Restart Docker

$ sudo systemctl restart docker

(However, something very strange happened on my machine - I still couldn't start docker as a normal user after restarting the docker service. I could only run it without sudo after restarting the machine.)

Docker image acceleration

I used Alibaba Cloud's free acceleration

https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors

For subsequent settings, just follow the instructions on the Alibaba Cloud website and I will not go into details.

Five: Reference Links

-Windows10 install WSL2 Ubuntu20.04 and set up docker environment
-Ubuntu Docker Installation

This is the end of this article about the steps to install docker on ubuntu20.04 LTS. For more information about installing docker on ubuntu20.04 LTS, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to install WSL2 Ubuntu20.04 on Windows 10 and set up the docker environment
  • Tutorial on installing and using Docker on Ubuntu 16.04
  • Detailed tutorial on installing and using Docker on Ubuntu 16.04
  • Detailed process of installing and using Docker on Ubuntu 20.04 (installation package)

<<:  MySQL master-slave data is inconsistent, prompt: Slave_SQL_Running: No solution

>>:  Vue implements zip file download

Recommend

MySQL 5.7.23 installation and configuration graphic tutorial

This article records the detailed installation pr...

Implementation steps for building multi-page programs using Webpack

It is very common to use webpack to build single-...

VMware ESXi 5.5 deployment and configuration diagram process

Table of contents 1. Installation requirements 2....

Detailed explanation of Nodejs array queue and forEach application

This article mainly records the problems and solu...

Docker Basics

Preface: Docker is an open source application con...

How to use provide to implement state management in Vue3

Table of contents Preface How to implement Vuex f...

MySQL optimization: how to write high-quality SQL statements

Preface There are a lot of information and method...

Detailed explanation of Linux netfilter/iptables knowledge points

Netfilter Netfilter is a packet processing module...

Difference between src and href attributes

There is a difference between src and href, and t...

How to delete garbled or special character files in Linux

Due to encoding reasons, garbled characters will ...

Linux installation apache server configuration process

Prepare the bags Install Check if Apache is alrea...

Detailed explanation of Truncate usage in MySQL

Preface: When we want to clear a table, we often ...