ubuntu18.04 安装docker

环境

本操作基于如下环境:

  1. ubuntu 18.04

使用ubuntu安装docker

卸载之前的docker

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

安装Docker

  1. sudo apt-get update
  2. sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common :安装依赖包
  3. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - :添加 Docker 的官方 GPG 密钥
  4. sudo apt-key fingerprint 0EBFCD88 :验证您现在是否拥有带有指纹的密钥
  5. sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" :设置稳定版仓库

安装 Docker Engine-Community

  1. sudo apt-get update :更新
  2. sudo apt-get install docker-ce :安装最新的Docker-ce
  3. 启动:
    1. sudo systemctl enable docker
    2. sudo systemctl start docker

测试

  1. sudo docker run hello-world
docker