Docker的安装使用
现在Docker分为社区版Docker CE和企业版Docker EE。Docker CE免费,Docker EE收费。Docker CE又分为Docker CE Edge和Docker CE Stable。Docker CE Edge每1个月发布一个版本,Docker CE Stable每3个月发布一个版本。Stable表示稳定版,所以下面只介绍Docker CE Stable。
Docker支持以下Ubuntu版本:
- Xenial 16.04 (LTS)
- Bionic 18.04 (LTS)
- Cosmic 18.10
- Disco 19.04
- 其他...
这里再说一下我的Ubuntu版本是16.04的...
卸载旧版本
$ sudo apt-get remove docker docker-engine docker.io containerd runc
安装Docker CE
step1. 更新源,安装相应的依赖包
$ sudo apt-get update $ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
step2. 安装Docker镜像(这里我用的是国内阿里Docker CE镜像)
至于为什么我只推荐阿里镜像,我使用过很多种方法来装Docker,其他的镜像总会出现各种奇奇怪怪的问题,只有阿里镜像安装的时候时最成功的,没碰到什么妖魔鬼怪- -!
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
安装完成后,使用指纹9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
对key进行验证
$ sudo apt-key fingerprint 0EBFCD88 pub 4096R/0EBFCD88 2017-02-22 Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid Docker Release (CE deb) <> sub 4096R/F273FCD8 2017-02-22
step3. 安装稳定版仓库
这里我还是使用的阿里repository
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
step4. 安装Docker CE
$ sudo apt-get update $ sudo apt-get install docker-ce
step5. 验证Docker CE是否安装成功
以root身份运行hello-world,答应出以下信息,则证明安装成功
$ sudo docker run hello-world Unable to find image ‘hello-world:latest‘ locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 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. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
相关推荐
王道革 2020-11-25
魅惑青花瓷 2020-11-11
lihongtai 2020-11-09
TaoTaoFu 2020-11-06
liaochaowu 2020-11-16
ChlatZed 2020-11-11
xysoul 2020-11-03
changecan 2020-09-22
newisI 2020-09-01
链块学院 2020-09-09
lihy0 2020-09-07
fearlessxjdx 2020-09-04
ChlatZed 2020-08-23
changecan 2020-11-19
bwyyziq 2020-11-22
pigsmall 2020-11-19
helloWorldAndYou 2020-11-16
nginxs 2020-11-14
红石丶 2020-11-13