ubuntu18.04 install docker18.06

My computer is installed with ubuntu18.04, and I am going to study docker. Let me introduce the installation of ubuntu.

Generally, the docker version in the official apt library may be relatively old. If there is one before, you can uninstall the old version that may exist first:

sudo apt-get remove docker docker-engin docker-ce docker.io

Update apt package index:

sudo apt-get update

Install the following packages to make the repository available to apt over https:

sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common

Add Docker’s official GPG key:

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

The docker package corresponding to Ubuntu 18.04 LTS (Bionic Beaver) is not available, so the stable repository can only be installed through the following statement

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

The following statement cannot be used. Many blogs recommend the following statement, which will export docker-ce and cannot be installed.

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

Update the following apt package index

sudo apt-get update

Install the latest version of Docker CE:

sudo apt-get install -y docker-ce

The latest version installed here is actually to install the latest version available on your computer, check the version available in the system:

apt-cache madison docker-ce

 

Select a specific version to install, the second column is the version string and the third column is the repository name which indicates which repository the package comes from and by extension its stability level. To install a specific version, append the version string to the package name and separate them with an equal sign (=):

sudo apt-get install docker-ce=<VERSION>

The command I use is apt-get install docker-ce=18.06.3-ce-0-ubuntu

Verify docker

Check whether the docker service is started:

systemctl status docker

If it is not started, start the docker service:

sudo systemctl start docker

Test the classic hello world:

sudo docker run hello-world After I run this command, it prompts that there is no such example. Maybe it was not installed during installation.

Guess you like

Origin blog.csdn.net/myemailsz/article/details/103469103