How to Create a Docker Base Setup for Drupal 1.0 CMS

Quick summary

Discover how to set up Drupal with Docker for a faster, consistent, and scalable development environment. This step-by-step guide covers quick setup, service integration, common fixes, and best practices to optimize your Drupal workflow with containers.

Introduction

Drupal is a free, open-source tool for building and managing websites and web applications. It is used as a back-end framework of all Web sites worldwide, There are multiple database types supported by this image, most easily used via Docker networks, in the default configuration.

Drupal needs software like Linux, Apache, MySQL, and PHP to work. Setting up Drupal manually can be slow and tricky. With Docker, you can automate the setup and make sure it works the same everywhere.

Why use Docker for Drupal?

Docker has become the go to tool for CMS projects like Drupal because it provides.

  • Consistency: Same environment across all machines.
  • Isolation: Each project runs in its own container, avoiding dependency conflicts.
  • Scalability: Easily add services like Redis, Varnish, and Elastic Search.
  • Faster onboarding: Developers can start immediately without complex setups.
  • Reliable deployments: works seamlessly with CI/CD pipelines.

For Drupal, this means:

  • No more “works on my machine” problems.
  • Stable PHP, Apache/Nginx, and MySQL versions.
  • Better team collaboration.

Prerequisites

Before you start, make sure you have: Docker Desktop install (Windows / macOS / Linux)
Docker Compose
Basic command-line knowledge
At least 4GB RAM (recommended)

  • Quick setup: Set up Drupal CMS with minimal commands.
  • Portability: Move projects between different environments easily.
  • Isolation: Each project runs in its own container without any conflicts.
  • Service integration: Quickly link to MySQL, Redis, or Elasticsearch containers.
  • Efficiency: Developers don’t need to manually replicate complex configurations.

For additional insights into improving your Drupal performance, you can simply check out optimizing Drupal performance: Tips to develop a faster website.

Step 1: Create project directory

Step 2: Create docker-compose.yml

Step 3: First run

Step 4: Fix file permissions (Linux)

Step 5: Create .env file

Step 6: Useful Docker commands

Step 7: Access services

  • Drupal → http://localhost:8080
  • PhpMyAdmin → http://localhost:8081

Database connection in Drupal installer

Use these values during installation:

  • Host: db
  • Database: Drupal
  • User: Drupal
  • Password: Drupal

For advanced Drupal integrations, you might also explore headless Drupal solutions: flexible, scalable & API integration.

Common issues or fixes

File permissions → Ensure /sites/default/files is writable.
Port conflicts → Change 8080 if already in use.
DB errors → Double-check host database and credentials.
Performance on Windows/macOS → Use Docker volumes carefully, as file sync is slower.

How Docker boosts workflow

  • Faster onboarding: Docker Compose up and you’re ready.
  • Parallel projects: Run multiple Drupal versions side by side.
  • CI/CD friendly: Easy integration with pipelines.
  • Debugging: Restart/replace containers without breaking.

Conclusion

Docker Drupal is one of the smart way to modernize your development workflow. It save setup time, ensures consistency across environments, and makes scaling easier.

Whether you’re a solo developer or part of a large team, this base setup provides a strong foundation for running Drupal projects in containers.

If you want to setup and focus on optimization, don’t miss our blog on optimizing Drupal performance: Tips to develop a faster website.

Author : Jay Prakash Kushwah Date: September 30, 2025