Skip to content

Instantly share code, notes, and snippets.

@rotated8
Last active June 14, 2022 14:43
Show Gist options
  • Save rotated8/00c808a71ccf7326442245a03308d4b6 to your computer and use it in GitHub Desktop.
Save rotated8/00c808a71ccf7326442245a03308d4b6 to your computer and use it in GitHub Desktop.
Docker Compose for Drupal
# Drupal with PostgreSQL
# Adapted from https://hub.docker.com/_/drupal/
#
# Access via "http://localhost:8080"
# (or "http://$(docker-machine ip):8080" if using docker-machine)
#
# Database type: PostgreSQL
# Database name: postgres
# Database username: postgres
# Database password: example
# ADVANCED OPTIONS; Database host: postgres
version: '3.1'
services:
drupal:
image: drupal:9-apache
ports:
- 8080:80
volumes:
- ./modules:/var/www/html/modules
- ./profiles:/var/www/html/profiles
- ./themes:/var/www/html/themes
- ./sites:/var/www/html/sites
restart: always
postgres:
image: postgres:10
environment:
POSTGRES_PASSWORD: example
restart: always
@rotated8
Copy link
Author

This assumes your modules, profiles, themes, and sites folders are in the current directory.

Run docker stack deploy -c stack.yml drupal or docker-compose -f stack.yml up, wait for initialization, then visit http://localhost:8080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment