Ubuntu 16.04 下安装 Docker 17.12

环境:

操作系统:Ubuntu 16.04.3 LTS

Docker版本:17.12.1-ce

1、配置IP地址

sudo vim /etc/network/interfaces

auto ens33
iface ens33 inet static
address 172.16.0.100
netmask 255.255.255.0
gateway 172.16.0.2

2、配置APT软件源

sudo  vim /etc/apt/sources.list

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

3、更新APT源索引

sudo  apt-get update

4、允许通过HTTPS方式使用APT源

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

5、添加Docker 官方源GPG KEY

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

6、验证GPG KEY添加是否成功

sudo apt-key fingerprint 0EBFCD88

7、设置安装Stable 版本的Docker

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

8、更新APT索引并安装Docker

sudo apt-get update

sudo apt-get install docker-ce

9、查看Docker版本

sudo docker version
sudo docker --version
sudo  docker info

10、验证Docker安装是否成功

sudo docker run hello-world

11、启动或关闭Docker engine

systemctl  start docker.service    #启动Docker 服务
systemctl status  docker.service  #查看Docker服务状态
systemctl stop docker.service  #关闭Docker 服务

更多Docker相关教程见以下内容: 

Docker 的详细介绍:请点这里
Docker 的下载地址:请点这里

相关推荐