Ubuntu system set up under docke

linux kernel version dependent

  • kernel version >= 3.8
  • You can use the following command to view
uname -a | awk '{split($3, arr, "-"); print arr[1]}'

Operating system dependent, the following versions can be

Disco 19.04

Cosmic 18.10

Bionic 18.04 (LTS)

Xenial 16.04 (LTS)

First installation need to uninstall the old version docker

Uninstall the old version

Docker older version called dockerordocker-engine

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

If apt-getthe report does not install these packages, then continue with the installation.

Setting repository

I installed for docker -ce, the community version, suitable for small teams.

1, the index update apt package:

$ sudo apt-get update

2, the installation package, in order to support https

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

3, add Docker's GPG key:

# Official sources 
curl -fsSL HTTPS: // download.docker.com/linux/ubuntu/gpg | sudo APT the Add-Key -
# 国内源
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88By searching for fingerprints after 8 characters, verify that you now have the key with 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]

4, the installation source is added

Use the following command to set a stable repository. To add a  night or testing repository, in the following command word back to add nightlyor test(or simultaneous) stable. Learn every night and test channels .

Note : The following lsb_release -cssub-command returns the name of the Ubuntu distribution, for example xenial. Sometimes, Linux Mint and other distributions, you may need to change $(lsb_release -cs) the parent Ubuntu distro. For example, if you use  Linux Mint Tessa, you can use bionic. Docker on the Ubuntu distribution untested and unsupported does not provide any guarantee.

# 添加安装源 # 推荐国内源 
sudo add-apt-repository \
    "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
    $(lsb_release -cs) \
    stable"

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

Installation docker -ce (Community Edition)

1, the index update apt package:

 
  
$ sudo apt-get update
 
  

2, install the latest version of Docker CE

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

Small expansion: Specifies the version installed, check the version

$ Apt-cache madison docker- the 

  docker -c | 5 : 18.09 . 1 ~ 3 - 0 ~ ubuntu-genius | https: // download.docker.com/linux/ubuntu great / stable amd64 Packages 
  docker-ce | 5 : 18.09 . 0 ~ 3 - 0 ~ ubuntu-genius | https: // download.docker.com/linux/ubuntu great / stable amd64 Packages 
  docker-ce | 18.6 . 1 ~ the ~ 3 - 0 ~ ubuntu | https: //download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  docker-ce | 18.06.0~ce~3-0~ubuntu       | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  ...

Specifies the version installed:

Second column version string using certain versions, e.g.5:18.09.1~3-0~ubuntu-xenial

$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

3, open docker

sudo systemctl enable docker
sudo systemctl start docker

4, verify, by running the hello-world image to verify correct

~$ sudo docker run hello-world
如果出现"Hello from Docker.", 则代表运行成功 Hello
from Docker! This message shows that your installation appears to be working correctly.

5, if the docker each run command is not added in front of sudo, execute the following command:

sudo usermod -aG docker $USER

Refer to the official website link:

https://docs.docker.com/install/linux/docker-ce/ubuntu/

Refer to our village link:

https://www.cnblogs.com/keyou1/p/11511067.html

 


 

Guess you like

Origin www.cnblogs.com/xingyunqiu/p/11584066.html