在docker标签之间切换

我在ubuntu机器上有一个基于apache,wsgi的python应用程序。 应用程序在docker集装箱内。 开发人员修复问题1,将其部署并交给testing人员。 开发人员修复了问题2,但无法部署,因为testing人员仍在testing问题1.开发人员是否可以在Docker镜像中创build标签并可以在它们之间切换? 他可以在两个标签或提交中有两个不同版本的代码,只要他或者testing者想要就可以在它们之间切换。

每次你提交一个容器,你将会得到一个不同的图像ID。 每个图像都可以独立标记。 例:

docker images REPOSITORY TAG IMAGE ID CREATED SIZE python 1.0 e0122ddbfbc5 23 hours ago 100 MB python latest e0122ddbfbc5 23 hours ago 100 MB 

更改1:

 docker commit python:1.1 docker images REPOSITORY TAG IMAGE ID CREATED SIZE python 1.0 e0122ddbfbc5 23 hours ago 100 MB python latest e0122ddbfbc5 23 hours ago 100 MB python 1.1 ba130ccb3f66 1 minute ago 101 MB 

更改2:

 docker commit python:1.2 docker images REPOSITORY TAG IMAGE ID CREATED SIZE python 1.0 e0122ddbfbc5 23 hours ago 100 MB python latest e0122ddbfbc5 23 hours ago 100 MB python 1.1 ba130ccb3f66 10 minute ago 101 MB python 1.2 946baf236fcc 1 minute ago 101 MB 

一旦被接受,您可以将图片标记为最新的:

 docker tag python:1.1 python:latest 

要么

  docker tag python:1.2 python:latest