如何检查Docker映像中的某些属性 [英] How to check for Certain Properties in Docker Images

查看:58
本文介绍了如何检查Docker映像中的某些属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的组织中有一组Docker基本映像.每个技术堆栈都有一个(例如Java或Python).我还可以为特定版本的Java构建这些基础映像,并将其推送到工件.

I have a set of Docker base images within my organization. I have one per technology stack (Java or Python for example). I can also build these base images for a specific version of Java and push it to the artifactory.

然后我们将有不同的项目,他们将使用这些基本映像并构造其Dockerfile.现在,我们要以某种方式确保在这些项目的构建过程中,它们确实确实使用了我在其Dockerfile中创建的基础映像!

We will then have different projects who will use these base images and construc their Dockerfile. We now want to somehow ensure during the build process of those projects that they did infact use the base image that I created in their Dockerfile!

例如,如果我在Alipine上为Java创建的图像称为

For example., if the image that I created for Java on Alipine is called

java-8-alpine-3

然后,需要Java运行时的项目应将其作为第一行:

Then the project that would need a Java runtime should have this as their first line:

FROM java-8-alipne-3

如何确保是这种情况?换句话说,如何检查图像以检查此类属性的使用情况?

How do I ensure that this is the case? In other words, how can I inspect the images to check for usage of such properties?

推荐答案

对于特定图像,您可以使用Century Link Image来对Docker图像进行反向工程

well for a particular image you can use century link image which will reverse engineer the docker image

docker run -v /var/run/docker.sock:/var/run/docker.sock \
centurylink/dockerfile-from-image <IMAGE_TAG_OR_ID>

单击此处了解更多信息

不幸的是,世纪链接图像使用了不推荐使用的docker tree命令,所以另一种解决方案是使用

unfortunately century link image use docker tree command which is depreciated so the other solution is to use this

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock 
nate/dockviz images -t

它将显示您可以检查所有图层的所有图层.

it will display all the layers you can go through inspecting all the layers then .

这篇关于如何检查Docker映像中的某些属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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