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?

  • Docker: Share the same .so library different containers without compiling into each
  • Installation in Intel System Studio error
  • Advice needed on how to setup a SAAS service for a php based application
  • Docker machine unable to start the remote machine
  • spark-submit can't use sparkConf to pass configuration parameters
  • Rebuild and ReRun a DockerContainer
  • nodemon not restarting after typescript change
  • How can I attach to docker container running in detached mode?
  • crontab not running in docker container shell
  • docker-compose can't find services or containers in Docker for Mac
  • Query docker embedded dns from host
  • Run OpenCv in jupyter with Docker
  • 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.