资讯专栏INFORMATION COLUMN

Docker学习笔记02-安装

Sanchi / 2637人阅读

摘要:的版本的版本分为社区版和企业版,想了解更多可以去官网查看其中分为和版本为季度发布版本,例如发布周期为一个季度为月度发布版本,例如发布周期为一个月安装前先在官网查看支持的平台,不同系统下的安装方法也都可以在官网找到,这里以在下安装为例下

Docker的版本

Docker的版本分为Docker-ce社区版和Docker-ee企业版,想了解更多可以去官网查看
其中Docker-ce分为stable和edge版本

stable为季度发布版本,例如v17.03 v17.06发布周期为一个季度

edge为月度发布版本,例如v17.01 v17.02发布周期为一个月

安装前先在官网查看Docker支持的平台,不同系统下的安装方法也都可以在官网找到,这里以在CentOS7下安装为例

CentOS7下安装Docker-ce
OS requirements
To install Docker CE, you need a maintained version of CentOS 7. Archived versions aren’t supported or tested.
The centos-extras repository must be enabled. This repository is enabled by default, but if you have disabled it, you need to re-enable it.
The overlay2 storage driver is recommended.

查看系统需求提示需要一个处于维护版本的CentOS7即可

Uninstall old versions
Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them, along with associated dependencies.

如果之前安装过Docker,根据提示先清除老版本的Docker

[root@centos7 ~]# yum remove docker 
           docker-client 
           docker-client-latest 
           docker-common 
           docker-latest 
           docker-latest-logrotate 
           docker-logrotate 
           docker-selinux 
           docker-engine-selinux 
           docker-engine
仓库方式安装

推荐的方式,便于安装和升级

需要安装yum-config-manager来更方便的管理yum仓库,yum-config-manager在yum-utils包中,所以先安装yum-utils

[root@centos7 ~]# yum install -y yum-utils device-mapper-persistent-data lvm2

安装完后添加Docker-ce的官方源

[root@centos7 ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

开启edge版本后,在选择指定版本安装时就能看到edge版本了

[root@centos7 ~]# yum-config-manager --enable docker-ce-edge

查看仓库列表检查是否添加成功

[root@centos7 ~]# yum repolist
安装最新版本
[root@centos7 ~]# yum install docker-ce
安装指定版本

先列出Docker仓库中可用的版本再选择安装,@代表已安装的软件包,返回的列表取决于启用了哪些仓库
其中EL是RedHatEnterpriseLinux的简写,其中el5/6/7的软件包用于Red Hat 5/6/7.x, CentOS 5/6/7.x, and CloudLinux 5/6/7.下的安装

[root@centos7 ~]# yum list docker-ce --showduplicates | sort -r
已加载插件:fastestmirror
可安装的软件包
Loading mirror speeds from cached hostfile
docker-ce.x86_64            18.06.0.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.03.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            18.03.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.0.ce-1.el7.centos             docker-ce-stable

执行命令yum install docker-ce-安装

[root@centos7 ~]# yum install docker-ce-18.03.1.ce-1.el7.centos
启动Docker服务
[root@centos7 ~]# systemctl start docker
验证Docker是否安装成功
[root@centos7 ~]# docker run hello-world
Unable to find image "hello-world:latest" locally
latest: Pulling from library/hello-world
9db2ca6ccae0: Pull complete 
Digest: sha256:4b8ff392a12ed9ea17784bd3c9a8b1fa3299cac44aca35a85c90c5e3c7afacdc
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/engine/userguide/
包方式安装

包方式安装需要下载.rpm文件进行安装,但当需要更新docker的时候也必须下载安装包来安装,下载地址

安装Docker的rpm包
[root@centos7 ~]# yum install docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm
启动Docker服务
[root@centos7 ~]# systemctl start docker
验证Docker是否安装成功
[root@centos7 ~]# docker run hello-world
卸载Docker
[root@centos7 ~]# yum remove docker-ce
[root@centos7 ~]# rm -rf /var/lib/docker

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/27399.html

相关文章

  • docker笔记1----Get Docker

    摘要:资源官网资源资源版本的安装参考这个资源安装参考这个资源阿里云开发者平台资源阿里云镜像加速器资源中文版资源参考学习安装时间第步卸载旧版本的手工删除里面有图象容器卷和网络现在的名字叫第步安装第步安装官方的 资源01: Docker官网资源02: Docker Store资源03: Ubuntu版本的Docker安装(参考这个)资源04: Docker-compose安装(参考这个) 资源...

    bawn 评论0 收藏0
  • Fabric学习笔记(三) - Fabric v1.0.5 使用CouchDB

    摘要:前言默认的为功能有限现在把它该归它提供了丰富的查询功能拉取使用启动利用上节教程使所有添加至改用安装请把环境变量都改为的实例化创建一些并交易 前言 默认的state DB为goleveldb,功能有限,现在把它该归CouchDB.它提供了丰富的查询功能 拉取coundb image docker pull hyperledger/fabric-couchdb:x86_64-1.0.5 d...

    liangzai_cool 评论0 收藏0
  • 初学Docker容器网络不得不看的学习笔记

    摘要:容器通过获取一个与同网段的地址,并默认连接到网桥,并将的地址作为网关实现容器与宿主机的网络互通,另外,同一个宿主机下同样使用模式的容器可以直接通讯。 【技术沙龙002期】数据中台:宜信敏捷数据中台建设实践|宜信技术沙龙 将于5月23日晚8点线上直播,点击报名 一、关于Docker Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从Apache2.0协议开源。 Docker...

    fanux 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<