Skip to content

Instantly share code, notes, and snippets.

@dsteindl
Created November 23, 2020 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsteindl/00b49711d6ee84d6067f8f82308736a0 to your computer and use it in GitHub Desktop.
Save dsteindl/00b49711d6ee84d6067f8f82308736a0 to your computer and use it in GitHub Desktop.
version: '3.2'
# create virtual network called "network-drupal"
# only containers attached to this network can communicate with each another.
networks:
network-drupal:
driver: bridge
services:
# the mariadb service
drupal-database:
image: bitnami/mariadb:10.4
# docker's internal DNS resolves the host "drupal-database" to this container.
# --> you can use "drupal-database" as database host!
# be sure, that your drupal instance has set up the correct database credentials!
container_name: drupal-database
environment:
MARIADB_ROOT_USER: "root"
MARIADB_ROOT_PASSWORD: "password"
MARIADB_USER: "drupal"
MARIADB_PASSWORD: "password"
MARIADB_DATABASE: "drupal"
# map your hosts port 3306 to the containers port 3306.
# that's only required, if you are interested in connecting to your database from the host
# e.g. view the database via a database client.
ports:
- "3306:3306"
volumes:
- "./volume-storage/database:/bitnami/mariadb:delegated"
# attach the container to the network (you can attach it to multiple if required)
networks:
- network-drupal
# the drupal service
drupal:
image: local/drupalimagename
container_name: drupal
volumes:
- "./web/sites/default/files:/var/www/html/web/sites/default/files:delegated"
- "./files/private:/var/www/html/files/private:delegated"
# map local port 80 to containers port 80 to be able to connect to the drupal instance via http
# once drupal is running, just navigate to localhost
ports:
- 80:80
networks:
- network-drupal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment