To specify a Dockerfile, we need to utilise two properties of build
, and they are context
and dockerfile
.
context
is for letting Docker Compose know where to look for a Dockerfile.
dockerfile
is for letting Docker Compose know the name of the Dockerfile.
version: '3'
services:
container-name:
build:
context: ./path/to/directory/
dockerfile: NameOfDockerFile