当子级定义另一个父级映像时,Docker父级映像的入口点会发生什么? [英] What happens to entrypoint of Docker parent image when child defines another one?

查看:108
本文介绍了当子级定义另一个父级映像时,Docker父级映像的入口点会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比方说,我已经通过此Dockerfile构建了Docker镜像 parent

Let's say I've got the Docker image parent built by this Dockerfile:

FROM ubuntu
ENTRYPOINT ["parent-entry"]

现在我从此继承父级在我的子级图像中使用以下代码构建:

Now I inherit from this parent image in my child image built with this code:

FROM parent
ENTRYPOINT ["child-entry"]

据我测试,子图像的入口点覆盖了父映像。

As far as I have tested it the entrypoint of the child image overwrites the one in the parent image.

但是由于我是Docker的新手,所以我对此不确定。我的研究还没有得出令人满意的答案。那么上述假设是否正确?

But since I am new to Docker I am not sure about this. My research also hasn't yet resulted in a satisfying answer. So is the assumption above correct?

推荐答案

使用了最后一个入口点,仅使用了最后一个入口点。

The last entrypoint is used, only the last one.

您可以检查并在 Dockerfile ENTRYPOINT 的行c $ c>,并检查会发生什么情况。

You can check, put several lines with different ENTRYPOINT in your Dockerfile, and check what happens.

这篇关于当子级定义另一个父级映像时,Docker父级映像的入口点会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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