Docker in Your Workflow

There are many different ways to integrate Docker into your, and your teams, workflows and development environments.

This course covers the essentials of using Docker in your daily workflow, including setting up an existing project to use Docker,, creating and configuring Docker-specific settings, and optimizing workflows for multi-client and multisite Drupal installations. Additionally, learners will explore advanced topics such as using external services, sharing containers with teams, automating builds, and managing Docker in production environments.

Key topics

  • Dockerize an existing project
  • Managing Docker configuration files
  • Using Docker for multisite Drupal installations
  • Integrating external services such as databases, caching systems, and search engines
  • Sharing Docker containers with team members
  • Using Docker Hub, and automated builds for Docker images on Docker Hub
  • Self-Hosted container registries
  • Whether to use Docker containers in production
Tutorials in this course
More information

Getting Drupal to run in Docker requires a lot of moving parts. After installing Docker and Docker Compose, we need to select a collection of containers from Docker Hub and create a new docker-compose.yml file. Once we have environment variables and volumes configured, this only gives us the capability of running a Drupal site in Docker.

What if we already have a Drupal site we want to develop using Docker? In this tutorial, we'll show how to modify an existing project to minimize the setup time necessary for switching to a Docker-based environment.

In this tutorial, we'll:

  • Describe the best practices for project organization.
  • Use an environment file to configure containers.
  • Add a Docker-specific settings.php file.
More information

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.
More information

One of the problems with Dockerizing an existing project is that configuration information tends to proliferate everywhere. Not only do we have settings in docker-compose.yml, but also in our Docker-specific settings file settings.docker.php. If we change a setting in one place we need to copy and paste it everywhere else. This can make things difficult if we suddenly have the need to change a setting.

Fortunately, there's a way to centralize Docker configuration for our project by using an environment file.

In this tutorial, we'll:

  • Review what an environment file is and its format.
  • List the advantages of moving Docker configuration to an environment file.
  • Describe the .env file, and how it provides us further advantages.
More information

Throughout this series we've been focused on working with a single set of containers and a single site. For most Drupal developers, however, we're expected to work with multiple client sites, sometimes several different ones in the same day.

When we add Docker into the mix, it can seem overwhelmingly complicated when you're used to working with other tools. Fortunately, there are several simple practices that not only work well with Docker, but also support your workflow.

In this tutorial, we'll:

  • Outline the best practices when building a local development environment in Docker.
  • Compare the differences in workflow when using Docker compared to other local development environments.
  • Discuss various strategies to reduce resource use on team workstations.
More information

A multisite Drupal installation allows you to host multiple, separate websites while relying on the same set of code. Large organizations often rely on a multisite installation to cut down on the operational upkeep of multiple sites. Hosting a multisite in Docker poses several additional challenges. Fortunately, the process is not dissimilar from configuring a bare-metal server to run a multisite.

In this tutorial, we'll:

  • Outline a multisite's additional requirements for Docker containers.
  • Configure alternate, local domain names to resolve each site.
  • Learn how to configure a multisite to use alternate domain names.
More information

Today's Drupal sites often rely upon external services in order to serve their visitors. When hosting such a site in Docker, we need to take special consideration in order to allow the site to access these essential components.

In this tutorial, we'll:

  • Outline the steps necessary for troubleshooting connectivity issues
  • Discuss steps to protect API keys and other sensitive pieces of information
  • Touch upon your options if you require external libraries or utilities
More information

One of the key advantages of Docker is that it makes it much easier to share your containers with your team members. For most of this series, we've been relying on containers hosted on Docker Hub. When we need to create a custom container for our team, we want to leverage that same sharing infrastructure.

In this tutorial, we'll:

  • Describe the various methods of sharing containers.
  • Outline the advantages of using Docker Hub.
  • Briefly describe why and when you should use a private container image registry.
More information

For many container images on Docker Hub, the preferred approach is to create an automatic build. An automatic build integrates Hub with a public Git repository, providing you an effective, open, and best-practice approach to sharing your containers with your team, and with the world.

In this tutorial, we'll:

  • List the advantages of creating an automatic build compared to other approaches on Docker Hub.
  • Describe the process of creating an automatic build.
  • Outline how to organize your git repository for your images.
  • Learn how to configure and trigger the build on Hub.
More information

Often it's useful for a container image to provide several variants of itself under the same name on Docker Hub. Docker uses tags to identify these variants. You can configure your own tags as part of your automatic build on Docker Hub.

In this tutorial, we'll:

  • Outline the uses for tags
  • Discuss the best practices for tag names
  • Learn how to add tags to your automatic build on Docker Hub
More information

Docker Hub provides a free, easy to use way of distributing your container images. However, there are situations where sharing your container images is either not ideal, bad practice, or against legal requirements. In those cases, you will want to use a private registry instead.

In this tutorial, we'll:

  • Describe what a private registry is.
  • Learn how to run Docker's own registry image.
  • Learn how to push and pull images from the self-hosted registry.
  • Outline the production concerns for the registry image.
  • List other options for self-hosting your own images.
More information

Docker provides numerous advantages for us as Drupal developers. It simplifies the management of infrastructure for our projects while allowing customization to suit each project's needs. Running Docker in production also brings a number of advantages, but it also creates new concerns.

In this tutorial, we'll:

  • Outline the advantages Docker brings to the production environment.
  • Highlight the concerns when planning a production deployment of Docker.
  • Describe container orchestration and list several container orchestration platforms to choose from.
This course appears in the following guides:
Backend and Infrastructure
Learn about Docker configuration and management in Drupal development.

Docker for Drupal Developers