Skip to main content
Image
Drupal 10

Install Drupal 10 from Docker4Drupal

Hello, let's end a hot and surely fun summer to start September with lots of energy!

I welcome you to this new article of my blog, in which we will review how to perform the installation of Drupal 10 in its latest version through docker4drupal on Ubuntu (Linux) distribution.

Why Docker4Drupal?

Docker4Drupal is one (if not the most) of the most used docker stacks when setting up Drupal infrastructures in the professional field, for several very specific reasons:

  1. Extremely easy to install.
  2. It is easy to maintain and scale, thanks to the use of Docker containers.
  3. It has a complete stack of very useful libraries and tools focused on Drupal.
  4. Has the recommended file and folder hierarchy structure, as well as composer and drush already installed and configured.

You can access the docker4drupal documentation through here.

Requirements before proceeding

We must meet the requirements check to continue downloading and using docker4drupal, and that includes:

  1. Instalar Docker.
  2. Install docker-compose as plugin.

To install Docker we enter the following commands from our shell, which will be used to update our local repositories and add the Docker gpg to it:

sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
 "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
 "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
 sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

And then we proceed to install Docker:

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Once installed, we verify the installation with the following command:

sudo docker run hello-world

To finish with the requirements, we install docker compose as a Docker plugin:

sudo apt-get update
sudo apt-get install docker-compose-plugi

We can now verify the installation by entering:

docker compose version

Preparing containers

First of all, we have to create a folder in which our Drupal 10 project will be located. Once inside it, we clone the docker4drupal repository:

git clone https://github.com/wodby/docker4drupal.git .

Now we will focus on modifying an important file: .env.

PROJECT_NAME=drupal10_juandels3
PROJECT_BASE_URL=juandels3.docker.localhost
PROJECT_PORT=8000

It is important to use port 8000 (or another) to avoid conflicts with ports used by other services, such as Apache (80) or Tomcat (8080). We can leave the variables section that establishes connectivity to the database by default. It is important that the DRUPAL_TAG variable is defined like this to use Drupal 10:

DRUPAL_TAG=10-[tag]

Define codebase

By default docker4drupal uses a remote path to host our codebase, so we can't easily access it from our favorite code editor or IDE. To modify this behavior and have our codebase at hand, we must modify the file docker-compose.override.yml. Specifically, we have to comment on the lines of the β€œcodebase” key of the PHP, crond and nginx services:

Docker compose fichero

Start containers and install Drupal

We have everything configured. Now it is time to start our containers with the following command:

docker compose up -d

Then the download and configuration of our containers will start. Once the process is finished, we can access our website through the browser to start the Drupal 10 installation setup:

http://juandels3.docker.localhost:8000
InstalaciΓ³n de Drupal

Docker4drupal is in charge of defining through the .env file the connection variables to our database and the execution of the first "composer install" that downloads the drupal core and all its dependencies, so following the Drupal 10 setup is very simple and we will only have to decide the installation profile, the language and the basic information of the site.

Conclusion

Docker makes it easy to manage services through containers, giving us the possibility to dispense with them when we need to, or add new ones if required. This particular stack, docker4drupal, has the most important and requested services and tools when carrying out projects with Drupal; all from an easy management and most importantly: a guarantee to the scalability and support of a web project with Drupal.

Thank you very much, and see you next time!

Join the Drupal Sapiens Community

Save content that interests you, connect with others in the community, contribute to win prizes and much more.

Login or create an account here

Latest posts

Featured

Last news