dockerfile与扩展

发布于 2025-01-27 21:38:18 字数 128 浏览 4 评论 0原文

是否可以将多个带有不同扩展的Dockerfile链接出来,以分别或在其他用例中链接某些服务。例如:

\Dockerfile.web \Dockerfile.celery

为什么?

Is it possible to have multiple Dockerfile's with different extensions to link some services separately or in other use cases. For example:

\Dockerfile.web \Dockerfile.celery

and why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一页 2025-02-03 21:38:18

您可能有多个Dockerfiles,但只能在构建图像时一次运行一个。默认情况下,docker build寻找名为dockerfile的文件。要指定另一个文件,请使用-f标志。

docker build                     // uses Dockerfile
docker build -f Dockerfile       // does the same as when run without -f
docker build -f Dockerfile.web   // uses Dockerfile.web

https://docs.docker.com/engine/engine/eengine/reference/commandline/commandline/buildline/ < /a>

You may have multiple Dockerfiles but you can only run one at a time when building an image. By default docker build looks for a file named Dockerfile. To specify another file use the -f flag.

docker build                     // uses Dockerfile
docker build -f Dockerfile       // does the same as when run without -f
docker build -f Dockerfile.web   // uses Dockerfile.web

https://docs.docker.com/engine/reference/commandline/build/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文