如何在一个目录中有多个 Dockerfile
通常你像这样构建 docker 镜像
docker_build_default.sh
docker build -t myimagename .但使用此方法你每个目录只能有一个 Dockerfile。
如果你不想为你的 Dockerfile 使用单独的目录,你可以使用 docker build 的 -f 参数:
docker_build_with_f.sh
docker build -f FirstDockerfile .注意你仍然需要在末尾添加 .,这样 docker build 才知道如果你的 Dockerfile 中有 COPY 或类似语句时从哪里 COPY 文件。
Check out similar posts by category:
Docker
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow