How does Drupal website work with docker compose?
Our Drupal site is going to be composed of two Docker images. The main image which holds the Drupal specific stuff, which we designated with the Dockerfile we made, and a database image. Docker Compose will allow use to create containers from these two images and have them connected to each other so that they “just work”.
Can you use Drupal with composer instead of Drush?
We’re installing Drush Launcher. Makes using Drush on the command-line easier now that it’s no longer recommended to install Drush globally. This deletes the copy of Drupal that ships with the Docker image. You can use this if you wanted, but in this post we’re installing and tracking Drupal with Composer instead with the help of Git.
Where do I create a docker compose file?
The Docker Compose file should also be created at the root of our project, ./docker-compose.yml. Many blog posts around the Internet with example Compose files will use version 2. We are using newer features of Docker Compose and thus this needs to be version 3 or higher.
How to build a Drupal website on the fly?
Instead of using image like we did for the DB and then specifying a Docker image, this tells Docker Compose to use the local Dockerfile as the basis for our image. This means we can build on the fly without running a separate command, or worse, pushing to a public Docker repository for a quick dev change.
How to export Drupal configuration to Drush file?
Now visit http://localhost:8080 in your browser and go through the Drupal installer. Once everything is installed and your site is good to go, we’re going to use Drush to export your Drupal configuration. Then, exit the container. We’re going to edit the .gitignore file that we have as well to remove lines 11 and 15.
How to create a Drupal database in MariaDB?
We also tell MariaDB to create a new database called “drupal” on startup and set the MariaDB root user’s password to “WaterfallSucks”. Feel free to use whichever DB name and password you like. The Docker Hub page for MariaDB provides more information on available environment variables.