How to have multiple Dockerfiles in one directory
Usually you build a docker image like
docker_build_default.sh
docker build -t myimagename .but using this method you can only have one Dockerfile in each directory.
In case you don’t want to have separate directories for your Dockerfiles you can use the -f argument to docker build:
docker_build_with_f.sh
docker build -f FirstDockerfile .Note that you still need to add . at the end so docker build knows where to COPY files from if you have COPY or similar statements in your Dockerfile.
Check out similar posts by category:
Docker
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow