Install drupal using docker

Install and configure the latest drupal using docker. The version is drupal10. drupal is an open source Content Management System (CMS), which provides a framework for building and operating websites. Drupal is a CMS that provides a framework for building and operating websites.

Drupal has the following features

  1. Highly customizable: Drupal has a very flexible structure, allowing site owners to customize their sites to their own needs.
  2. Modules: Drupal’s functionality can be extended with addable components called modules. Thousands of modules are available free of charge to add specific functionality or change the behavior of the site.
  3. Community: Drupal has a vast community around the world. This provides a wealth of support for problem solving, and new modules and improved versions are released frequently.
  4. Security: Drupal provides such reliable security that it is used by public institutions and large companies that require high security.

Drupal is a powerful and versatile system, but it also requires a certain amount of learning to master. However, the control and customizability that comes with that learning curve is a tremendous advantage.

The following official image is used to achieve this. First, start up the container with a simple command.

https://hub.docker.com/_/drupal/

docker run --name test -d drupal

Go into the container that has been successfully launched and examine the directory structure. The main files were as follows

docker exec -ti test bash

/etc/apache2 -> web server configuration file
/usr/local/etc/php -> PHP related
/var/www/html -> document root

Now that we have identified the locations of the important files, we will copy these from the container to the host. First, create a directory on the host.

mkdir dr

The following command will copy the important files from the container to the host.

docker cp test:/etc/apache2 /root/dr/apache2
docker cp test:/usr/local/etc/php /root/dr/php
docker cp test:/var/www/html/modules /root/dr/modules
docker cp test:/var/www/html/profiles /root/dr/profiles
docker cp test:/var/www/html/sites /root/dr/sites
docker cp test:/var/www/html/themes /root/dr/themes

Now that the files have been fetched, stop and delete the container.

docker stop test
docker rm test

Start the container so that it is actually operational.

docker run \
 --name test \
 -p 8881:80 \
 -v /root/dr/php:/usr/local/etc/php \
 -v /root/dr/apache2:/etc/apache2 \
 -v /root/dr/modules:/var/www/html/modules \
 -v /root/dr/profiles:/var/www/html/profiles \
 -v /root/dr/sites:/var/www/html/sites \
 -v /root/dr/themes:/var/www/html/themes \
 -d drupal

This docker command uses port number 8881 on the host side, so we’ll allow this traffic, and since we’re launching on an OracleCloud instance, we’ll also allow it in the ingress rules. When running at home, we will set the port open on the router.

ufw allow 8881/tcp

Access the site with a browser.

http://IP address:8881

The installation screen was displayed normally, but after proceeding a little further, an error occurred.

The translations directory does not exist.
The installer requires that you create a translations directory as part of the installation process. translations . More details about installing Drupal are available in INSTALL.txt.

I forgot to check in the container earlier, but the ownership of the following directory was www-data. Mounting has changed the ownership, so we will restore it.

modules, sites, themes

chown -R www-data:www-data modules sites themes

You will be asked to enter the database information on the way to the page, but you can proceed by entering the necessary information. The default transaction isolation level for MySQL, MariaDB, and similar databases is “REPEATABLE READ”. The recommended transaction isolation level for Drupal sites is “READ COMMITTED”. I did not encounter any other errors because I used a normal bootable image and launched the container with Docker.

The installation was completed successfully, but most of the files are in English, so if this is difficult for you, you can download and import the Japanese file. Download the file from the following page. The file extension is .po.

https://localize.drupal.org/translate/languages/ja

The import procedure is as follows.

Go to Configuration -> User interface translation, import the file in the import tab and install.

After that, it should be in Japanese.

Please share if you like it!
TOC