博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Centos7安装与卸载Docker
阅读量:4113 次
发布时间:2019-05-25

本文共 3650 字,大约阅读时间需要 12 分钟。

依赖配置

1.查看是否有旧的安装包,如果有,需要卸载

yum remove docker docker-common docker-selinux docker-engine

2.检查内核版本(Docker 要求 CentOS 系统的内核版本高于 3.10)

[root@eric112 ~]# uname -r4.17.8-1.el7.elrepo.x86_64

如果你的版本不满足需求,需要升级内核

方法一:通过yum安装

1.安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的

yum install -y yum-utils device-mapper-persistent-data lvm2

2.添加docker的yum源

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

3.查看仓库中可用的docker版本,然后选择指定的版本安装

[root@eric112 ~]# yum list docker-ce --showduplicates | sort -rRepository epel is listed more than once in the configurationRepository epel-debuginfo is listed more than once in the configurationRepository epel-source is listed more than once in the configuration已加载插件:fastestmirror可安装的软件包 * updates: mirrors.aliyun.comLoading mirror speeds from cached hostfile * extras: mirrors.aliyun.com * elrepo: mirrors.tuna.tsinghua.edu.cndocker-ce.x86_64            18.06.0.ce-3.el7                    docker-ce-stabledocker-ce.x86_64            18.03.1.ce-1.el7.centos             docker-ce-stabledocker-ce.x86_64            18.03.0.ce-1.el7.centos             docker-ce-stabledocker-ce.x86_64            17.12.1.ce-1.el7.centos             docker-ce-stabledocker-ce.x86_64            17.12.0.ce-1.el7.centos             docker-ce-stabledocker-ce.x86_64            17.09.1.ce-1.el7.centos             docker-ce-stabledocker-ce.x86_64            17.09.0.ce-1.el7.centos             docker-ce-stabledocker-ce.x86_64            17.06.2.ce-1.el7.centos             docker-ce-stabledocker-ce.x86_64            17.06.1.ce-1.el7.centos             docker-ce-stabledocker-ce.x86_64            17.06.0.ce-1.el7.centos             docker-ce-stabledocker-ce.x86_64            17.03.2.ce-1.el7.centos             docker-ce-stabledocker-ce.x86_64            17.03.1.ce-1.el7.centos             docker-ce-stabledocker-ce.x86_64            17.03.0.ce-1.el7.centos             docker-ce-stable * base: mirrors.aliyun.com

4.安装docker

yum install 
#FULLY-QUALIFIED-PACKAGE-NAME为docker-ce-详细版本号,如docke-ce-17.06.2.ce-1.el7.centos或者yum install docker-ce #安装最新的稳定版

5.验证docker是否安装成功(有client和service两部分表示docker安装启动都成功了)

[root@eric112 ~]# docker versionClient: Version:           18.06.0-ce API version:       1.38 Go version:        go1.10.3 Git commit:        0ffa825 Built:             Wed Jul 18 19:08:18 2018 OS/Arch:           linux/amd64 Experimental:      false

6.启动docker

systemctl start docker #启动dockersystemctl enable docker #设置docker为开机自启

7.查看docker是否启动成功

[root@eric112 ~]# systemctl status docker● docker.service - Docker Application Container Engine   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)   Active: active (running) since 五 2018-08-03 23:06:03 CST; 5s ago     Docs: https://docs.docker.com Main PID: 1450 (dockerd)    Tasks: 28   Memory: 50.2M   CGroup: /system.slice/docker.service           ├─1450 /usr/bin/dockerd           └─1458 docker-containerd --config /var/run/docker/containerd/containerd.toml

方法二:通过脚本安装

curl -fsSL https://get.docker.com/ | sh  #最新正式版或者wget -qO- https://get.docker.com/ | sh  #最新正式版或者curl -fsSL https://test.docker.com/ | sh  #预发布版本,不建议在生成中使用

至此,docker安装启动成功。

卸载docker

1.查看已安装的docker

[root@eric112 ~]# yum list installed | grep dockerRepository epel is listed more than once in the configurationRepository epel-debuginfo is listed more than once in the configurationRepository epel-source is listed more than once in the configurationdocker-ce.x86_64                     18.06.0.ce-3.el7               @docker-ce-stable

2.使用yum卸载

yum remove -y docker-ce.x86_64   #docker-ce.x86_64为已安装的docker,以实际安装的版本为准

 

转载地址:http://ddgsi.baihongyu.com/

你可能感兴趣的文章
Golang面试考题记录 ━━ 字符串中的第一个唯一字符 ,拓展:ASCII和strings字符串查找的用法
查看>>
Golang面试考题记录 ━━ 有效的字母异位词,久违的双100%,拓展reflect.DeepEqual()用法和[26]int{}的值
查看>>
Golang面试考题记录 ━━ 验证回文串,多种方法涉及双指针、strings、unicode和regexp
查看>>
Golang面试考题记录 ━━ 字符串转换整数 (atoi),知识点ascii、rune、uint8、string、char等转换
查看>>
Golang面试考题记录 ━━ 实现 strStr() 函数,截然不同三种方案,效率都差不多,双100%
查看>>
Golang面试考题记录 ━━ 外观数列 , 了解递归、bytes.Buffer和闭包
查看>>
学习日志 ━━ 理解递归(使用go语法举例)
查看>>
Golang面试考题记录 ━━ 最长公共前缀,字符串就是切片,复习[]byte、[]rune、[]uint8、[]int32和单引号
查看>>
Golang学习日志 ━━ 单向链表
查看>>
Golang面试考题记录 ━━ 删除链表中的节点,首先明白什么是链表,其次语文要好能看懂题
查看>>
买股票就是为卖好价钱 十种不应下单的情况
查看>>
用.NET建立Office Add-in
查看>>
数码相片冲印尺寸对照表
查看>>
用Photoshop制作1寸和2寸的照片
查看>>
HTTP协议
查看>>
9个月的婴儿的喂养
查看>>
宝宝出牙顺序图
查看>>
XML简单读写
查看>>
10款宝宝最爱的家常辅食
查看>>
Visual Studio 2005 开发WPF应用程序系列文章——什么是WPF
查看>>