在 CentOS 7 上升级 docker [英] Upgrade docker on CentOS 7

查看:36
本文介绍了在 CentOS 7 上升级 docker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 centos 7 并使用 epel 包在主机上安装了 docker:

I'm running centos 7 and have installed docker on host using epel packages:

yum install epel-release
yum install docker

但是docker版本是-Docker version 0.11.1-dev, build 02d20af/0.11.1

But the docker version is-Docker version 0.11.1-dev, build 02d20af/0.11.1

docker 最新的稳定分支是 1.2

The latest stable branch of docker is 1.2

我在这台主机上运行了几个容器,那么如何在这台主机上安全地更新 docker?

I'm running couple of containers on this host, so how can i update docker safely on this host?

yum update docker 不会更新到最新版本,因为 epel repo 有旧包.

yum update docker does not update to the latest version as the epel repo has old package.

推荐答案

请注意,目前 Docker 的稳定版本实际上是 1.3,而不是 1.2. 请参阅 Docker CHANGELOG 以发现最新版本.

Note that current stable version of Docker is actually 1.3, not 1.2. See the Docker CHANGELOG to discover the latest version.

在升级您的 docker 主机之前,您可能需要备份您拥有的一些 docker 镜像,尤其是那些从 docker commit 命令发出的镜像.为此,请查看 docker export 命令.您可能还想备份容器的卷.为此,请查看 Docker 数据用户指南卷.

Before upgrading your docker host, you might want to backup some of the docker images you have, especially those issued from the docker commit command. To do so, take a look at the docker export command. You might also want to backup your containers' volumes. For that take a look at the Docker user guide on data volumes.

一旦您确信您拥有最终重新开始所需的所有备份,您就可以继续升级您的 Docker 守护程序.

Once you are confident you have all the backups you need for an eventual fresh start you can move on upgrading your Docker daemon.

CentOS 7 的 Docker 安装指南如果你想要最新的,建议从 binaries 安装 docker.我建议您按照这些说明安装最新的 docker. Docker 现在通过 yum 包管理器提供更新.

On the Docker installation guide for CentOS 7, it is advised to install docker from the binaries if you want the latest. I suggest you follow those instructions to install the latest docker. Docker now provides updates through the yum package manager.

完成此操作后,使用 docker images 命令验证您是否仍有 Docker 映像,并使用 docker ps 检查您的容器.如果缺少一些,请从备份中重新创建它们.

Once done with that use the docker images command to verify if you still have your Docker images and docker ps to check your containers. If some are missing, recreate them from your backups.

如果您从自定义 Dockerfile 创建了 Docker 映像,您还希望重新构建这些映像以检查没有 Dockerfile 与新的 Docker 守护程序存在问题.Docker 0.11.1 和 1.3 之间存在 巨大差距,并修复和为 Dockerfiles 语法带来了新功能.

If you created docker images from custom Dockerfiles, you also want to rebuild those images to check that no Dockerfile has issues with the new Docker daemon. There is a big gap between Docker 0.11.1 and 1.3 and fixes and new features were brought to the Dockerfiles syntax.

这里是你准备好升级 docker 后要运行的命令的详细信息:

In details here are the commands to run once you are ready to upgrade docker:

# stop the docker service
$ sudo service docker stop

# download the latest docker binary and replace the current outdated docker
# DEPRECATED WAY TO UPGRADE DOCKER: $ sudo wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O /usr/bin/docker
$ sudo yum update docker-engine

# start the docker service
$ sudo service docker start

# check the version
$ sudo docker version

# check the images and containers
$ sudo docker images
$ sudo docker ps
$ sudo docker ps -a

这篇关于在 CentOS 7 上升级 docker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆