Is it a normal practice to include more than one Dockerfile in a project?

If I have a web project in source control and I want to include all the necessary configuration to run it, should I be using more than one Dockerfile to define different profiles for my database, web and data containers?

Are there any examples of this practice?

  • Using docker/docker-machine in multiple Terminal tabs on OSX
  • Multiple services to run on a container or multiple containers Docker?
  • How to get a list of components and related assets out of Nexus3?
  • How to get contents generated by a docker container on the local fileystem
  • can't connect to docker container from outside
  • Docker security isolation what does it mean exactly?
  • Docker - overlay network on rhel 7
  • Is it possible to use Docker Toolbox on Visual Studio Code?
  • Docker in Docker: Port Mapping
  • Transparent proxying for all docker containers
  • In a Dockerfile, How to update PATH environment variable?
  • Docker: sending logs to localhost doesn't work but does work, why?
  • 2 Solutions collect form web for “Is it a normal practice to include more than one Dockerfile in a project?”

    No, You should either allow the profiles to be mounted in using volumes so that you can use the same container with different configurations or setup all the configurations and then allow the profile to be selected based on environment variable or commands to docker run.

    The first approach is preferable as no information about your configuration bleeds into the container definition. You may even make your container public as it may be of use to other people.

    If you are only changing configuration parameters I would recommend you to reuse the Dockerfile and pass a configuration file as a parameter.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.