如何使用本地映像作为基础映像与docker文件? [英] How can I use a local image as the base image with a dockerfile?
问题描述
我只是意识到我一直在使用索引图像的
FROM
。 所以我奇迹:
- 如何使用我的本地(自定义)图像作为我的基础(
FROM
)图像没有将
推到索引?
你可以使用它而不做任何特别的事情。如果您有一个名为 blah
的本地图片,您可以执行 FROM blah
。如果您在Docker文件中执行 FROM blah
,但不要具有名为 blah的本地映像
,然后 Docker将尝试从注册表中提取它。
换句话说,如果Dockerfile FROM ubuntu
,但您有一个本地映像名为 ubuntu
与官方不同,您的映像将覆盖它。
I'm working on a dockerfile.
I just realised that I've been using FROM
with indexed images all along.
So I wonder:
- How can I use one of my local (custom) images as my base (
FROM
) image withoutpushing
it to the index?
You can use it without doing anything special. If you have a local image called blah
you can do FROM blah
. If you do FROM blah
in your Dockerfile, but don't have a local image called blah
, then Docker will try to pull it from the registry.
In other words, if a Dockerfile does FROM ubuntu
, but you have a local image called ubuntu
different from the official one, your image will override it.
这篇关于如何使用本地映像作为基础映像与docker文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!