如果我 运行 `docker-compose up` 是否需要目录中的 Dockerfile 以及 docker-compose.yml 文件?
If I run `docker-compose up` do I need a Dockerfile in the directory as well as a docker-compose.yml file?
使用命令 docker-compose up
时,我的目录中是否一定要有 Dockerfile?我不认为 Dockerfile 是必需的,但想确定一下。
如果我只有 docker-compose.yml 文件使用预构建的图像,就不需要 Dockerfile。
请指正!提前致谢。
docker-撰写可让您在 2 个选项之间进行选择
从指定的镜像构建容器:
services:
example:
image: your/imagename
从 Dockerfile 构建容器:
services:
example:
build:
context: path/to/Dockerfile/dir
dockerfile: Dockerfile #here you specify the name of your Dockerfile file
使用命令 docker-compose up
时,我的目录中是否一定要有 Dockerfile?我不认为 Dockerfile 是必需的,但想确定一下。
如果我只有 docker-compose.yml 文件使用预构建的图像,就不需要 Dockerfile。
请指正!提前致谢。
docker-撰写可让您在 2 个选项之间进行选择
从指定的镜像构建容器:
services: example: image: your/imagename
从 Dockerfile 构建容器:
services: example: build: context: path/to/Dockerfile/dir dockerfile: Dockerfile #here you specify the name of your Dockerfile file