如何命名 Dockerfile [英] How to name Dockerfiles

查看:103
本文介绍了如何命名 Dockerfile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定如何命名 Dockerfile.GitHub 上的许多人使用没有文件扩展名的 Dockerfile.我给他们一个名字和扩展名吗?如果是这样呢?还是我直接称它们为 Dockerfile?

I'm unsure of how to name Dockerfiles. Many on GitHub use Dockerfile without a file extension. Do I give them a name and extension; if so what? Or do I just call them Dockerfile?

推荐答案

[请阅读完整答案]如果要在 hub 上使用 autobuilder,请不要更改 dockerfile 的名称.码头工人.com.不要为 docker 文件使用扩展名,将其保留为空.文件名应该只是:(根本没有扩展名)

[Please read the full answer]Don't change the name of the dockerfile if you want to use the autobuilder at hub.docker.com. Don't use an extension for docker files, leave it null. File name should just be: (no extension at all)

Dockerfile

但是,现在您可以将 dockerfile 命名为,

However, now you can name dockerfiles like,

test1.Dockerfile
$ docker build -f dockerfiles/test1.Dockerfile  -t test1_app .

Dockerfile.test1
$ docker build -f dockerfiles/Dockerfile.test1  -t test1_app .

这也可以.

如果您处理位于同一上下文中的多个文件,则可以使用 STDIN:

If you handle multiple files that live in the same context, you could use STDIN:

test1.Dockerfile
$ docker build -t test1_app - < test1.Dockerfile

这篇关于如何命名 Dockerfile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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