如何使用本地映像作为基础映像与docker文件? [英] How can I use a local image as the base image with a dockerfile?

查看:133
本文介绍了如何使用本地映像作为基础映像与docker文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个docker文件。
我只是意识到我一直在使用索引图像的 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 without pushing 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屋!

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