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

Detailed tutorial on installing and configuring MySql5.7 on Ubuntu 20.04

Table of contents 1. Ubuntu source change 2. Inst...

js to implement collision detection

This article example shares the specific code of ...

Detailed explanation of two points to note in vue3: setup

Table of contents In vue2 In vue3 Notes on setup ...

MySQL 5.7.18 installation and configuration tutorial under Windows

This article shares the installation and configur...

Comprehensive analysis of MySql master-slave replication mechanism

Table of contents Master-slave replication mechan...

About MySQL innodb_autoinc_lock_mode

The innodb_autoinc_lock_mode parameter controls t...

Detailed explanation of HTML's <input> tag and how to disable it

Definition and Usage The <input> tag is use...

In-depth explanation of InnoDB locks in MySQL technology

Table of contents Preface 1. What is a lock? 2. L...

A brief analysis of different ways to configure static IP addresses in RHEL8

While working on a Linux server, assigning static...

About Generics of C++ TpeScript Series

Table of contents 1. Template 2. Generics 3. Gene...

What is html file? How to open html file

HTML stands for Hypertext Markup Language. Nowada...