泊坞窗中的“图像”和“构建”之间的区别 [英] Difference between 'image' and 'build' within docker compose
本文介绍了泊坞窗中的“图像”和“构建”之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我了解docker compose中'image'和'build'之间的区别
Please help me understand the difference between 'image' and 'build' within docker compose
推荐答案
-
图像
表示docker compose
将基于该图像运行容器 - build 表示
docker compose
首先将基于在相关路径中找到的Dockerfile构建映像与构建(然后基于该图像运行容器)。 image
meansdocker compose
will run a container based on that image- build means
docker compose
will first build an image based on the Dockerfile found in the path associated with build (and then run a container based on that image).
PR 2458 合并以允许两者(并在构建时使用 image
作为映像名称,
PR 2458 was eventually merged to allow both (and use image
as the image name when building, if it exists).
dockerfile:
作为build:
下的子语句,可用于指定Dockerfile的文件名/路径。
dockerfile:
as a sub-statement beneathbuild:
can be used to specify the filename/path of the Dockerfile.
version: '3'
services:
webapp:
build:
context: ./dir
dockerfile: Dockerfile-alternate
args:
buildno: 1
这篇关于泊坞窗中的“图像”和“构建”之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文