ununtu如何安装DockerCE

这篇文章给大家分享的是有关ununtu如何安装Docker CE的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

创新互联专注于中小企业网站建设、策划制作、运行维护,主要提供一站式的企业网站建设服务。建站类型:公司网站建设、品牌网站建设、成都外贸网站制作独立站等。创新互联不是单一的建网站,而是结合企业的建站目标去规划网站怎么建,如何利于运营,寻求适合的建站方案。其次,网站后台操作的便捷性也是网站制作过程中的重点,创新互联的网站后台简单便捷,真正实现了零基础操作。

docker 安装前准备-操作系统列表需要满足如下版本的ubuntu

  • Cosmic 18.10

  • Bionic 18.04 (LTS)

  • Xenial 16.04 (LTS)

卸载旧版本docker,如果安装过的请操作如下,如果使用普通账号执行,请按如下操作,如果有root权限请忽略sudo,系统首次安装请略过此步骤

$ sudo apt-get remove docker docker-engine docker.io containerd runc

安装docker ce

1.设置仓库

$ sudo apt-get update

2. 安装包允许apt通过HTTPS使用存储库

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

3. 添加Docker的官方GPG密钥

$ curl -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=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

6.安装docker ce

#更新apt包索引
$ sudo apt-get update

7.安装最新版本docker ce或者跳到下步安装指定版本

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

8.安装指定版本的docker ce

$ apt-cache madison docker-ce

docker-ce | 5:18.09.6~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:18.09.5~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:18.09.4~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:18.09.3~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:18.09.2~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:18.09.1~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 5:18.09.0~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 18.06.3~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 18.06.2~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 18.06.1~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 18.06.0~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
docker-ce | 18.03.1~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages

以5:18.09.6~3-0~ubuntu-bionic版本为例,执行如下命令

$ sudo apt-get install docker-ce=5:18.09.6~3-0~ubuntu-bionic docker-ce-cli=5:18.09.6~3-0~ubuntu-bionic containerd.io

9.运行测试实例,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:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8
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 ce

1.卸载docker ce

$ sudo apt-get purge docker-ce

2. 主机上的映像、容器、卷或自定义配置文件不会自动删除。删除所有图像、容器和卷

$ sudo rm -rf /var/lib/docker

感谢各位的阅读!关于“ununtu如何安装Docker CE”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

当前题目:ununtu如何安装DockerCE
网页网址:https://www.cdcxhl.com/article0/ggojoo.html

成都网站建设公司_创新互联,为您提供App设计做网站小程序开发手机网站建设静态网站网站导航

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都网站建设