Home > Back-end >  Dockerfile with extension
Dockerfile with extension

Time:05-12

Is it possible to have multiple Dockerfile's with different extensions to link some services separately or in other use cases. For example:

\Dockerfile.web \Dockerfile.celery

and why?

CodePudding user response:

You may have multiple Dockerfiles but you can only run one at a time when building an image. By default docker build looks for a file named Dockerfile. To specify another file use the -f flag.

docker build                     // uses Dockerfile
docker build -f Dockerfile       // does the same as when run without -f
docker build -f Dockerfile.web   // uses Dockerfile.web

https://docs.docker.com/engine/reference/commandline/build/

  • Related