码迷,mamicode.com
首页 > 其他好文 > 详细

Docker的安装使用

时间:2020-04-21 14:56:09      阅读:48      评论:0      收藏:0      [点我收藏+]

标签:transport   creat   new   ESS   cos   新源   tac   osi   pull   

  现在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) <docker@docker.com>
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/

 

Docker的安装使用

标签:transport   creat   new   ESS   cos   新源   tac   osi   pull   

原文地址:https://www.cnblogs.com/SiminL0708/p/12744394.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!