In short, Docker is an open source tool that allows the use of containers. Containers consist of predefined lines of code built by the community. Anyone can push his docker file for other people to use. Of course, Docker has a lot more functionality that I just mentioned: mounting volumes, linking containers and so on. In this blog, I will document my little experience on setting up a full Drupal Development Environment!
As usual, Google search engine was my hero. I came up with many tutorials which helped me to get started with Docker.
Step 0: Install Docker
At first, this step was confusing... docker commands were known for its long commands. Mainly due to flags. But hopefully, I only had to follow the steps command by command!Step 1: Set up Drupal Development Environment
1.1. To start with, a database was needed for local development. In this command, I run a database from the MariaDB image, put 'drupal' as database password and named the container 'drupaldock'docker run --name drupaldock -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=drupal -d mariadb
1.2. Here we are basically creating and running the Drupal development environment from the insready/drupal-dev image and simultaneously linking the previously created database to it. I named the container 'd8docker' and assigned it the port 8080.
docker run --name d8docker --link drupaldevdb:mysql -p 8080:80 -d drupal
1.3. Now Drupal installation can start. I proceeded by surfing to localhost:8080.
Installation went fine until I was stuck on the 4th step of the installation. Neither did I know that the host name was the database container's name nor that the database username was automatically set to 'root'. Hopefully one of the comments in the Insready website enlightened me:
Database type: MySQL, MariaDB, Percona Server or equivalent
Database name: drupal
Database username: root
Database password: password
Host: drupaldock
Port number: 3306
The installation was now done! I could use Drupal like a real LAMP or MAMP installation. I remember how it was complicated for me to install Drupal via LAMP back then; Docker definitely makes it easier!
Thank you. This is so informative.
ReplyDelete