Reputation: 175
Do I absolutely need to have a Dockerfile in my directory when using the command docker-compose up
? I don't believe a Dockerfile is necessary but want to be sure.
If I only have a docker-compose.yml file using pre-built images, there would be no need for a Dockerfile.
Correct me please! Thanks in advance.
Upvotes: 15
Views: 6931
Reputation: 5622
docker-compose lets you choose between the 2 options
build the container from a specified image:
services:
example:
image: your/imagename
build the container out of a Dockerfile:
services:
example:
build:
context: path/to/Dockerfile/dir
dockerfile: Dockerfile #here you specify the name of your Dockerfile file
Upvotes: 19