Skip to content

Quick start

Persistence of database data

You will lose MariaDB / PostgreSQL data if you run docker-compose down. Instead use docker-compose stop to stop containers. Alternatively, you can use a manual volume for mariadb data (see compose file), this way your data will always persist.

There are 2 options how to use docker4drupal – you can either run vanilla Drupal from the image or mount your own Drupal codebase:

Option 1: Run Vanilla Drupal from Image (default)

  1. Download docker-compose.yml file from the latest stable release
  2. Optional: update php and nginx images tags if you want to run Drupal 7 or 6 (by default Drupal 8)
  3. Run containers: docker-compose up -d (it may take some time for them to initialize)
  4. Configure domains
  5. That's it! Proceed with Drupal installation at http://drupal.docker.localhost:8000. Default database user, password and database name are all drupal, database host is mariadb
  6. You can see status of your containers and their logs via portainer: http://portainer.drupal.docker.localhost:8000

Option 2: Mount my Drupal Codebase

  1. Download docker-compose.yml file from the latest stable release to your Drupal project root
  2. Replace php image from wodby/drupal (PHP + vanilla Drupal) to wodby/drupal-php (just PHP)
  3. Depending on your Drupal version use appropriate tags for php and nginx images
  4. Update nginx and php volumes to - ./:/var/www/html to mount your codebase
  5. Update NGINX_SERVER_ROOT (or APACHE_SERVER_ROOT) to /var/www/html unless your project is based on composer template
  6. Ensure your settings.php uses the same credentials as mariadb service
  7. Optional: import existing database
  8. Optional: uncomment lines in the compose file to run redis, solr, etc
  9. Configure domains
  10. Run containers: docker-compose up -d
  11. That's it! Your drupal website should be up and running at http://drupal.docker.localhost:8000
  12. You can see status of your containers and their logs via portainer: http://portainer.drupal.docker.localhost:8000

You can stop containers by executing:

docker-compose stop

Have a problem? See known issues, submit a new issue on GitHub or ask community on Slack

Permissions issues

To avoid potential problems with permissions between your host and containers please follow these instructions

For macOS users

Docker for Mac volumes has poor performance. However there are workarounds, read more here

Feel free to adjust volumes and ports in the compose file for your convenience.