Add a Docker-Specific Settings File

Dockerizing a project helps to simplify setting up new developer workstations, and on-boarding new team members. All the pieces of infrastructure necessary to get started are all in the Compose file. Yet, it's not as easy as it could be.

We still need to create a settings.local.php file with all the necessary database connection information and any setting overrides. In this tutorial, we'll move those out of the local settings file and into a Docker specific settings file that ships with all that information pre-configured out of the box.

In this tutorial, we'll:

  • Explain the motivation behind having a Docker-specific settings file.
  • Describe how to modify settings.php to detect when it's in a Docker environment.
  • Create a Docker-specific settings file with everything preconfigured.