是否可以从Docker容器中提取Dockerfile [英] Is it possible to extract the Dockerfile from a docker container

查看:201
本文介绍了是否可以从Docker容器中提取Dockerfile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用Docker,因此能够查看用于创建现有Docker映像的Dockerfile将会非常有帮助。

I'm just starting out with Docker, and it would be very helpful to be able to see the Dockerfiles used to create existing docker images.

即使图像是通过手动运行命令来构建的,然后提交给标签,也很高兴能够看到图像的制作方式,对于学习目的和安全性。

Even if the image was built by running commands manually, and then committing to a tag, it would be nice to be able to see how the image was made, both for learning purposes and for security.

是否可以提取Dockerfile或用于构建给定Docker映像的命令列表?

Is there a way to extract a Dockerfile or list of commands used to build a given docker image?

推荐答案

您有泊坞窗历史记录< image> 非常有用。如果没有任何步骤涉及stdin,它甚至可以用于生成dockerfile。

You have docker history <image> that is very helpful. It can even be used to generate a dockerfile if none of the steps involved stdin.

如果将步骤作为stdin,知道发生了什么事的唯一方法就是 docker日志< Container id parent> ,但是如果您没有该容器,则不能。

If a step as stdin, the only way to know what happened would be to do docker logs <container id parent>, but if you do not have the container, you can't.

这篇关于是否可以从Docker容器中提取Dockerfile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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