Docker Engine-Community supports the following Ubuntu versions:
Xenial 16.04 (LTS)
Bionic 18.04 (LTS)
Other updated versions...
Docker Engine - Community supports x86_64 (or amd64) armhf, arm64, s390x (IBM Z), and ppc64le (IBM Power) architectures.
Uninstall old version
The old version of Docker is called docker, docker.io or docker-engine. If they are already installed, uninstall them:
$ sudo apt-get remove docker docker-engine docker.io containerd runc
Currently known as the Docker Engine-Community package docker-ce .
Install Docker Engine-Community, here are two ways.
1、Install using a Docker repository
Before installing Docker Engine-Community for the first time on a new host, you need to set up a Docker repository. After that, you can install and update Docker from the repository.
#Update apt package
$ sudo apt-get update
Install the apt dependency package to get 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 a key with a fingerprint by searching for the last 8 characters of the fingerprint.
$ sudo apt-key fingerprint 0EBFCD88
$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ 未知 ] Docker Release (CE deb) <email@example.com>
sub rsa4096 2017-02-22 [S]
Use the following instructions to set up a stable repository
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Install Docker Engine-Community
Update apt package
$ 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
To install the specified version of Docker Engine-Community, list the available versions in the repository and select an installation. List the versions available in your repository:
$ apt-cache madison docker-ce
docker-ce | 5:19.03.4~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:19.03.3~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:19.03.2~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:19.03.1~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:19.03.0~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:18.09.9~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:18.09.8~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
Use the version string in the second column to install the specified version, for example 5:19.03.4~3-0~ubuntu-bionic.
$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
To test if Docker is installed successfully, enter the following command and print out the following information to install successfully:
$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
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.
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:
For more examples and ideas, visit:
2、Install using a shell script
Docker provides convenient scripts on get.docker.com and test.docker.com for quick installation of the edge and beta versions of Docker Engine-Community. The source code for the script is in the docker-install repository. It is not recommended to use these scripts in a production environment, and you should be aware of the potential risks before using them:
The script needs to run root or have sudo privileges. Therefore, the script should be carefully reviewed and reviewed before running the script.
These scripts try to detect the Linux distribution and version and configure the package management system for you. In addition, the script does not allow you to customize any of the installation parameters. From a Docker perspective or from the perspective of your own organization's guidelines and standards, this can lead to unsupported configurations.
These scripts will install all the dependencies and recommendations of the package manager without confirmation. This may install a large number of packages, depending on the current configuration of the host.
The script does not provide an option to specify which version of Docker to install, but instead installs the latest version released in the edge channel.
If you have used other mechanisms to install Docker on your host, do not use a convenience script.
This example uses the script on get.docker.com to install the latest version of Docker Engine-Community on Linux. To install the latest beta version, use test.docker.com instead. In each of the following commands, replace the test with get each time.
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
If you are using Docker as a non-root user, you should consider adding users to the docker group in a similar way as follows:
$ sudo usermod -aG docker your-user