flyDeDog 2020-04-21
现在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版本:
这里再说一下我的Ubuntu版本是16.04的...
$ sudo apt-get remove docker docker-engine docker.io containerd runc
$ sudo apt-get update $ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
至于为什么我只推荐阿里镜像,我使用过很多种方法来装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
这里我还是使用的阿里repository
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get update $ sudo apt-get install 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/