How to deploy the open source Drupal CMS with Docker

Jack Wallen walks you through the process of deploying Drupal with Docker so you can have a powerful content management system up and running in minutes.

drupal-9-thumbnail.jpg

Image: Drupal

Drupal is one of the most popular CMS tools on the market. With a robust set of content management tools, sophisticated APIs to make multichannel publishing easy and a proven track record of continuous innovation, you'll find this platform more than capable of serving your digital needs.

Although Drupal isn't terribly challenging to install on bare metal, if your preference is the container route, you're in luck. With the help of Docker4Drupal, you can get this powerful CMS system deployed in minutes.

Let me show you how.

SEE: Kubernetes: A cheat sheet (free PDF)  (TechRepublic)

What you'll need

To deploy Drupal, you'll need a platform that supports Docker, which means you can deploy this to your in-house data center or on a cloud-hosted service (such as AWS, Google Cloud, Azure, Linode or Rackspace). You'll also need a user with sudo privileges. 

I"ll be demonstrating this deployment on my go-to server OS, Ubuntu Server 20.04. 

How to install Docker

The first thing to do is install the container runtime engine for deployment. For this, we'll use Docker. 

Log in to your server and install Docker with the command:

sudo apt-get install docker.io -y

Once Docker is installed, add your user to the Docker group with the command:

sudo usermod -aG docker $USER

Log out and log back in.

You're now ready to deploy Drupal.

How to deploy Drupal via Docker Compose

To successfully deploy Drupal with Docker, we must do it in two parts. The first is the deployment of the MySQL database, followed then by Drupal itself. 

To deploy MySQL, you'll issue the command:

docker run --name MYSQL-NAME -e MYSQL_ROOT_PASSWORD=PWORD -d mysql:latest

Where MYSQL-NAME is the name you want to give the database host and where PWORD is a secure/unique password.

Once the database has been deployed, you can then follow up with the Drupal container like so:

docker run --name drupal --link MYSQL-NAME:mysql -p 8080:80 -e MYSQL_USER=root -e MYSQL_PASSWORD=PWORD -d drupal

Where MYSQL-NAME is the name you configured for your database host and PWORD is the password you set for MySQL.

The Drupal deployment will take a minute or two. When it completes, open a browser and point it to http://SERVER:8080 (where SERVER is the IP address or domain of the hosting server). You'll be greeted by the first screen of the Drupal setup wizard (Figure A).

Figure A

drupala.jpg

The Drupal setup wizard will walk you through the final steps of the deployment.

The Drupal setup wizard requires just a few simple steps before you're logging in to the deployment. The steps are:

Profile - Select the type of deployment you want to use (from minimal, standard and demo).

Requirements - You must enter the database information. To do this, click ADVANCED OPTIONS and enter the following (Figure B):

  • Database name: drupal

  • Database user: root

  • Database password: Set during MySQL container deployment

  • Database host: The value entered for MYSQL-NAME during the MySQL container deployment

Figure B

drupalb.jpg

Entering the database information for the Drupal deployment.

The Drupal installation will start and finish at the final screen of the wizard, where you can configure various bits of information about your new Drupal deployment (Figure C).

Figure C

drupalc.jpg

Configuring your Drupal site from the setup wizard.

Fill out the information and click Save And Continue. You'll then be prompted to log in to your site with the admin user, where you can begin managing your content.

Subscribe to TechRepublic's How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

Also see