Skip to content

Instantly share code, notes, and snippets.

@dsteindl

dsteindl/docker-compose.yml Secret

Created Nov 23, 2020
Embed
What would you like to do?
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