如何访问历史 docker '<missing>' 图片
how to access history docker '<missing>' images
昨晚修改了很多代码后,我做了一个新的图像,然后发现不对劲。虽然代码回滚非常复杂,但我建议对所有最终用户应用程序使用以前的映像,而不是在他们的 docker 文件中使用 latest
版本。
问题是所有的历史图片都显示了<missing>
,和两年前的一样。那么,我能不能确定一下,最后一次修改是在2年前,这样我就可以为所有最终用户制作一个标签?
谢谢。
IMAGE CREATED CREATED BY SIZE COMMENT
c40bfd5de465 14 hours ago /bin/sh -c #(nop) CMD ["sh" "-c" "./docker-… 0B
<missing> 14 hours ago /bin/sh -c #(nop) EXPOSE 18080/tcp 0B
<missing> 14 hours ago /bin/sh -c chmod a+x $AUTO_RUN_DIR/$VKERSERV… 6.74kB
<missing> 14 hours ago /bin/sh -c #(nop) COPY file:1b1e438b24742cd0… 6.74kB
<missing> 14 hours ago /bin/sh -c #(nop) COPY file:5d809f1661bd3bdb… 3.25kB
<missing> 14 hours ago /bin/sh -c #(nop) COPY file:7208a6bafb3a6a01… 2.85kB
<missing> 14 hours ago /bin/sh -c #(nop) COPY file:64bca67554c00d6c… 3.03kB
<missing> 14 hours ago /bin/sh -c mkdir -p /runtime/temp/vkmq/ 0B
<missing> 14 hours ago /bin/sh -c mkdir -p /root/vkds/vkredis-api/v… 0B
<missing> 14 hours ago /bin/sh -c mkdir -p $WORK_PATH 0B
<missing> 14 hours ago /bin/sh -c #(nop) ENV VKREDIS_APPNAME= VKRE… 0B
<missing> 14 hours ago /bin/sh -c #(nop) ENV INIT_MYSQL=init_mysql… 0B
<missing> 14 hours ago /bin/sh -c #(nop) ENV VKERSERVER_START=vkse… 0B
<missing> 14 hours ago /bin/sh -c #(nop) ENV AUTO_RUN_DIR=/docker-… 0B
<missing> 14 hours ago /bin/sh -c #(nop) ENV WORK_PATH=/usr/local/… 0B
<missing> 14 hours ago /bin/sh -c #(nop) ADD file:57dbba438276944df… 118MB
<missing> 2 years ago /bin/sh -c #(nop) ADD file:346d4cb58fff5e7b9… 2.02kB
<missing> 3 years ago /bin/sh -c #(nop) CMD ["mysqld"] 0B
<missing> 3 years ago /bin/sh -c #(nop) EXPOSE 3306/tcp 0B
<missing> 3 years ago /bin/sh -c chmod 777 /var/run/mysqld 0B
<missing> 3 years ago /bin/sh -c mkdir /var/run/mysqld 0B
<missing> 3 years ago /bin/sh -c pip install --upgrade awsebcli 11.4MB
<missing> 3 years ago /bin/sh -c pip install --upgrade awscli 38.2MB
<missing> 3 years ago /bin/sh -c apt-get -q -y install python-pip 97.5MB
<missing> 3 years ago /bin/sh -c apt-get -q -y install grunt 6.12MB
<missing> 3 years ago /bin/sh -c apt-get -q -y install npm 238MB
<missing> 3 years ago /bin/sh -c apt-get -q -y install mysql-server 359MB
<missing> 3 years ago /bin/sh -c apt-get update 10.2MB
这是最终用户 docker-compose.yml:
中的示例组件
XXX-server:
image: code.xxx.com.cn:4567/redis/redis-server:latest
container_name: service-redis
docker history
输出显示了制作图像的步骤;它不显示图像的过去版本。如果您的图像是 FROM
其他图像构建的,则 docker history
输出也包括其步骤。如果我要从那段历史中猜测,你有一个相当旧的基础镜像(包括一些命令行工具,Node,还有一个 MySQL 守护进程),一个稍新的中间镜像(COPY
中的一些文件),然后你当前的 Docker 文件被构建 FROM
那。
在当前 Docker 上,如果“图像”列显示 <missing>
,您将无法返回到该中间层作为图像。 (在非常旧的 Docker 版本上,这通常是可能的。)
不过,使用 Docker 图像来支持您所描述的那种回滚是很常见的。不要将您的图像标记为 latest
;相反,使用日期戳或源代码控制提交 ID 作为图像标记。
image: code.xxx.com.cn:4567/redis/redis-server:20201113
然后,如果您发现今天的构建不起作用,您可以轻松地将其切换回昨天的构建。
也可以在docker-compose.yml
文件中使用variable substitution让具体的镜像版本作为环境变量传入:
image: code.xxx.com.cn:4567/redis/redis-server:${REDIS_TAG:-latest}
REDIS_TAG=20201113 docker-compose up -d
昨晚修改了很多代码后,我做了一个新的图像,然后发现不对劲。虽然代码回滚非常复杂,但我建议对所有最终用户应用程序使用以前的映像,而不是在他们的 docker 文件中使用 latest
版本。
问题是所有的历史图片都显示了<missing>
,和两年前的一样。那么,我能不能确定一下,最后一次修改是在2年前,这样我就可以为所有最终用户制作一个标签?
谢谢。
IMAGE CREATED CREATED BY SIZE COMMENT
c40bfd5de465 14 hours ago /bin/sh -c #(nop) CMD ["sh" "-c" "./docker-… 0B
<missing> 14 hours ago /bin/sh -c #(nop) EXPOSE 18080/tcp 0B
<missing> 14 hours ago /bin/sh -c chmod a+x $AUTO_RUN_DIR/$VKERSERV… 6.74kB
<missing> 14 hours ago /bin/sh -c #(nop) COPY file:1b1e438b24742cd0… 6.74kB
<missing> 14 hours ago /bin/sh -c #(nop) COPY file:5d809f1661bd3bdb… 3.25kB
<missing> 14 hours ago /bin/sh -c #(nop) COPY file:7208a6bafb3a6a01… 2.85kB
<missing> 14 hours ago /bin/sh -c #(nop) COPY file:64bca67554c00d6c… 3.03kB
<missing> 14 hours ago /bin/sh -c mkdir -p /runtime/temp/vkmq/ 0B
<missing> 14 hours ago /bin/sh -c mkdir -p /root/vkds/vkredis-api/v… 0B
<missing> 14 hours ago /bin/sh -c mkdir -p $WORK_PATH 0B
<missing> 14 hours ago /bin/sh -c #(nop) ENV VKREDIS_APPNAME= VKRE… 0B
<missing> 14 hours ago /bin/sh -c #(nop) ENV INIT_MYSQL=init_mysql… 0B
<missing> 14 hours ago /bin/sh -c #(nop) ENV VKERSERVER_START=vkse… 0B
<missing> 14 hours ago /bin/sh -c #(nop) ENV AUTO_RUN_DIR=/docker-… 0B
<missing> 14 hours ago /bin/sh -c #(nop) ENV WORK_PATH=/usr/local/… 0B
<missing> 14 hours ago /bin/sh -c #(nop) ADD file:57dbba438276944df… 118MB
<missing> 2 years ago /bin/sh -c #(nop) ADD file:346d4cb58fff5e7b9… 2.02kB
<missing> 3 years ago /bin/sh -c #(nop) CMD ["mysqld"] 0B
<missing> 3 years ago /bin/sh -c #(nop) EXPOSE 3306/tcp 0B
<missing> 3 years ago /bin/sh -c chmod 777 /var/run/mysqld 0B
<missing> 3 years ago /bin/sh -c mkdir /var/run/mysqld 0B
<missing> 3 years ago /bin/sh -c pip install --upgrade awsebcli 11.4MB
<missing> 3 years ago /bin/sh -c pip install --upgrade awscli 38.2MB
<missing> 3 years ago /bin/sh -c apt-get -q -y install python-pip 97.5MB
<missing> 3 years ago /bin/sh -c apt-get -q -y install grunt 6.12MB
<missing> 3 years ago /bin/sh -c apt-get -q -y install npm 238MB
<missing> 3 years ago /bin/sh -c apt-get -q -y install mysql-server 359MB
<missing> 3 years ago /bin/sh -c apt-get update 10.2MB
这是最终用户 docker-compose.yml:
中的示例组件XXX-server:
image: code.xxx.com.cn:4567/redis/redis-server:latest
container_name: service-redis
docker history
输出显示了制作图像的步骤;它不显示图像的过去版本。如果您的图像是 FROM
其他图像构建的,则 docker history
输出也包括其步骤。如果我要从那段历史中猜测,你有一个相当旧的基础镜像(包括一些命令行工具,Node,还有一个 MySQL 守护进程),一个稍新的中间镜像(COPY
中的一些文件),然后你当前的 Docker 文件被构建 FROM
那。
在当前 Docker 上,如果“图像”列显示 <missing>
,您将无法返回到该中间层作为图像。 (在非常旧的 Docker 版本上,这通常是可能的。)
不过,使用 Docker 图像来支持您所描述的那种回滚是很常见的。不要将您的图像标记为 latest
;相反,使用日期戳或源代码控制提交 ID 作为图像标记。
image: code.xxx.com.cn:4567/redis/redis-server:20201113
然后,如果您发现今天的构建不起作用,您可以轻松地将其切换回昨天的构建。
也可以在docker-compose.yml
文件中使用variable substitution让具体的镜像版本作为环境变量传入:
image: code.xxx.com.cn:4567/redis/redis-server:${REDIS_TAG:-latest}
REDIS_TAG=20201113 docker-compose up -d