Skip to content

Quick start

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

  1. Clone docker4drupal repository and switch to the latest stable tag or download/unpack the source code from the latest release
  2. Optional: for Drupal 7 or 6 comment out corresponding DRUPAL_TAG and NGINX_TAG in .env file
  3. Configure domains
  4. From project root directory run docker-compose up -d or make up to start containers. Give it 10-20 seconds to initialize after the start
  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 docker4drupal.tar.gz from the latest stable release and unpack to your Drupal project root. If you choose to clone the repository delete docker-compose.override.yml as it's used to deploy vanilla Drupal
  2. Ensure NGINX_SERVER_ROOT (or APACHE_SERVER_ROOT) is correct, by default set to /var/www/html/web for composer-based projects where Drupal is in web subdirectory
  3. Ensure database access settings in your settings.php corresponds to values in .env file, e.g.:
    $databases['default']['default'] = array (
      'database' => 'drupal', // same as $DB_NAME
      'username' => 'drupal', // same as $DB_USER
      'password' => 'drupal', // same as $DB_PASSWORD
      'host' => 'mariadb', // same as $DB_HOST
      'driver' => 'mysql',  // same as $DB_DRIVER
      'port' => '3306', // different for PostgreSQL
      'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', // different for PostgreSQL
      'prefix' => '',
    );
    
  4. Configure domains
  5. Optional: for Drupal 7 or 6 comment out corresponding PHP_TAG and NGINX_TAG in your .env file
  6. Optional: import existing database
  7. Optional: uncomment lines in the compose file to run redis, solr, varnish, etc
  8. Optional: macOS users please read this
  9. Optional: Windows users please read this
  10. Run containers: docker-compose up -d or make up (see all make commands)
  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

Optional files

If you don't need to run multiple projects and don't use docker-sync to improve volumes performance on macOS feel free to delete traefik.yml and docker-sync.yml that come with the docker4drupal.tar.gz

You can stop containers by executing docker-compose stop or make stop

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

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