Install the latest version of Docker CE on Ubuntu 18.04 [Document compliant]

2019/7/12

Currently, Docker has a commercial version of Docker EE (enterprise edition) and a free version of Docker CE (community edition).What used to be called "Docker" or "docker engine" is now Docker CE.

This article is how to install Docker CE (as of 18.04: 19.03) on Ubuntu 2019.7.

Reference page
Docker Documentation:Get Docker CE for Ubuntu

Installation requirements

  • 64-bit version Ubuntu
  • Versions: 19.04 (Disco), 18.10 (Cosmic), 18.04 LTS (Bionic), 16.04 LTS (Xenial)

procedure

(If you have already installed the previous version of docker, you need to uninstall it.)
$ sudo apt-get remove docker docker-engine docker.io containerd runc

(XNUMX) Update of apt package

$ sudo apt-get update

(XNUMX) Install the package to use the repository via HTTPS

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

(XNUMX) Get the official Docker key

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

Confirm that the key "9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88" is acquired correctly with the following command.

$ 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) docker@docker.com
sub rsa4096 2017-02-22 [S]

(XNUMX) Set up a stable repository

The commands differ depending on the Linux architecture (x86_64 / amd64, armhf, arm64, ppc64le, s390x).The architecture is$ archIn can be confirmed.

Ubuntux86_64.x86_64Oramd64The repository setup command at this time is

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

For other architectures, just replace the [arch = ○○○] part on the second line with that architecture.

(XNUMX) Installation of Docker CE

Finally, execute in the following order.

(Update index of apt packege) $ sudo apt-get update (install the latest version of Docker CE and container) $ sudo apt-get install docker-ce docker-ce-cli containerd.io (enable docker and "Hallo" -world ") $ sudo docker run hello-world

If it is installed successfully, the following display will appear.

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 3. Hub. (Amd64)
3. The Docker daemon created 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/

reference

Initial settings after installing Docker
[Ubuntu] Settings and precautions for running docker without the sudo command

Settings when using GPU container
Enable GPU-enabled containers with Docker

Reference books