CentOS 7.6 docker 升级记录
一、背景使用CentOS linux搭建Devops环境时,运行Rancher.报不支持的Docker 版本,当前运行版本为17.05.0-ce。二、选择版本点击红色提示,跳到支持列表页面,查看选择升级的版本。选择了最新的同时支持k8s的社区版本 18.09.x-ce,https://rancher.com/docs/rancher/v1.6/en/hosts/#suppo...
·
一、背景
使用CentOS linux搭建Devops环境时,运行Rancher.报不支持的Docker 版本,当前运行版本为17.05.0-ce。
二、选择版本
点击红色提示,跳到支持列表页面,查看选择升级的版本。选择了最新的同时支持k8s的社区版本 18.09.x-ce,
https://rancher.com/docs/rancher/v1.6/en/hosts/#supported-docker-versions
三、升级过程
1、卸载旧版本【直接按照官方文档操作】,执行脚本。官方文档地址:https://docs.docker.com/install/linux/docker-ce/centos/
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2、安装新版本
执行脚本:curl https://releases.rancher.com/install-docker/18.09.sh | sh。如下是执行过程
[root@localhost ~]# curl https://releases.rancher.com/install-docker/18.09.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15429 100 15429 0 0 3865 0 0:00:03 0:00:03 --:--:-- 3864
+ '[' centos = redhat ']'
+ sh -c 'yum install -y -q yum-utils'
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/04efe80d41ea3d94d36294f7107709d1c8f70db11e152d6ef562da344748581a-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
Trying other mirror.
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
+ sh -c 'yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo'
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
+ '[' stable '!=' stable ']'
+ sh -c 'yum makecache fast'
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 9.1 kB 00:00:00
* base: mirrors.aliyun.com
* epel: mirrors.yun-idc.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
dockerrepo | 2.9 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/2): docker-ce-stable/x86_64/updateinfo | 55 B 00:00:01
(2/2): docker-ce-stable/x86_64/primary_db | 37 kB 00:00:02
Metadata Cache Created
+ sh -c 'yum install -y -q docker-ce-18.09.9'
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-18.09.9-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-ce-18.09.9-3.el7.x86_64.rpm is not installed
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <docker@docker.com>"
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://download.docker.com/linux/centos/gpg
+ '[' -d /run/systemd/system ']'
+ sh -c 'service docker start'
Redirecting to /bin/systemctl start docker.service
+ sh -c 'docker version'
Client: Docker Engine - Community
Version: 19.03.5
API version: 1.39 (downgraded from 1.40)
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:25:41 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.9
API version: 1.39 (minimum version 1.12)
Go version: go1.11.13
Git commit: 039a7df
Built: Wed Sep 4 16:22:32 2019
OS/Arch: linux/amd64
Experimental: false
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker your-user
Remember that you will have to log out and back in for this to take effect!
WARNING: Adding a user to the "docker" group will grant the ability to run
containers which can be used to obtain root privileges on the
docker host.
Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
for more information.
3、启动Docker服务
[root@localhost ~]# systemctl restart docker
4、启动容器,查看容器运行情况。
发现有部分容器自启动了。没启动的使用docker start 容器名称启动
四、验证
更多推荐
已为社区贡献1条内容
所有评论(0)