Ubuntu 安装 Docker CE

OS requirements

To install Docker CE, you need the 64-bit version of one of these Ubuntu versions:

  • Cosmic 18.10
  • Bionic 18.04 (LTS)
  • Xenial 16.04 (LTS)

一. Uninstall old versions(卸载旧版本)

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

二. set up Docker’s repositories (使用存储库安装)

sudo apt-get update

#Install packages to allow apt to use a repository over HTTPS:
#安装包以允许apt通过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 -

#Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.
sudo apt-key fingerprint 0EBFCD88
 
 
#Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below. Learn about nightly and test channels.

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


三. Install Docker CE

  1. Update the apt package index:
sudo apt-get update
  1. Install the latest version of Docker CE and containerd, or go to the next step to install a specific version:
sudo apt-get install docker-ce docker-ce-cli containerd.io
  1. Verify that Docker CE is installed correctly by running the hello-world image.
sudo docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

参考:docker-docs

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。