Testing a new Drupal 8 installation with 2 Docker commands
skyred 发布
While I was mentoring GSoC 2015 Hawk Auth project, we wanted to test the project in D8 sandbox often. Simplytest.me doesn't help here, because Hawk Auth uses Composer Manager to download extenal PHP library. (Another project using this set up is Commerce for D8.) There is an issue of supporting Composer in Simplytest.me queue, but it hasn't been followed up.
Therefore, we tried to use Docker to spin up a new Drupal installation. It was very fast and simple. Below is the documentation:
Step 0: Install Docker
Step 1: Spin up a database
(here we created a docker container called "drupaldb" using "mariadb" image, then we created a database "drupal" and set root password to be "password")
Step 2: Spin up Drupal 8
(here we created a docker container called "d8docker" using "drupal:8.1.8" image, then used port 80 on localhost for access and linked to the database container we just created)
Done. Now, you can open localhost or 127.0.0.1 on your browser to install Drupal into the database. If your localhost port 80 is being used, then you can change this section "80:80" in the above command to something like "1234:80", which will use port 1234 on your localhost.
Step 2.1: if you need to access the terminal of the D8 website container
(once you in, execute "export TERM=xterm" in your terminal for using text editor)
Step 2.2: if you want to read the log
Step 3: Cleaning up