ubuntu16.04安装docker

docker有企业版(EE版)和社区版(CE版),企业版是要收费的,所以选择社区版进行安装。

系统要求:

不是所有的ubuntu版本都能安装cocker,因为docker是使用go语言编写的,所以早期的ubuntu版本并不能支持,能安装的版本包括

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

1:更新仓库

 sudo apt-get update

2:安装apt使用https所需的包

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

 3:添加GPG密钥

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

4:校验密钥

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) <docker@docker.com>
sub   rsa4096 2017-02-22 [S]

 则表示校验成功

5:安装仓库,稳定仓库:

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

特别说明,不同处理器的安装是不一样的,上面命令是在arm64处理器上的安装命令,下面列举不同处理器的安装命令:

#x86_64/amd
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
#armhf
sudo add-apt-repository \
   "deb [arch=armhf] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
#ppc64le (IBM Power)
sudo add-apt-repository \
   "deb [arch=ppc64el] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable

 

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

:6:更新一下源:

sudo apt-get update

:7:开始安装docker

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

如果需要安装指定的版本号,可以使用

apt-cache madison docker-ce

 列出查看所有的docker版本,安装指定版本命令:

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

到此,安装完毕,查看helloworld

sudo docker run hello-world

首次运行会提示没有镜像,docker会自动到远程仓库里下载hello-world镜像

 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

 看到上面输出,表示安装成功,docker相关命令可以使用docker --help查看

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值