docker-with-waves.jpg
Illustration: Lisa Hornung/TechRepublic

Joomla is a world-class, open-source content management system that is search-engine and mobile-friendly, multilingual and flexible; it also offers unlimited design potential. With more than 110 million downloads, 10,000+ extensions and templates, Joomla is used on 2 million+ websites. You might deploy Joomla for business websites or portals, e-commerce or online publications.

With the help of Docker, you can quickly deploy a containerized version of Joomla and use it for just about anything. Let’s do just that.

SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)

What you’ll need to deploy Joomla with Docker

I’ll demonstrate the deployment on an instance of Ubuntu Server 22.04 using the Docker runtime engine. You’ll need a running instance of Ubuntu Server, which can be running on-premises or a cloud host, such as AWS, Azure or Google Cloud, and a user with sudo privileges.

How to install Docker

Install Docker

We’re going the simple route and installing Docker from the default repositories. Log into your Ubuntu server and install Docker with:

sudo apt-get install docker.io -y

Add your user to the docker group

Add your user to the docker group with:

sudo usermod -aG docker $USER

Make the system aware of the new group with:

newgrp docker

How to create a network and pull the images

Create a new Docker network

First, we must create a network for Joomla with the command:

docker network create joomla-network

Next, pull the Joomla and MySQL images with the following commands:

docker pull mysql:5.7
docker pull joomla

How to deploy the database

Create the MySQL volume

First, we’ll create the volume for the database with the command:

docker volume create mysql-data

Deploy the database

Next, we’ll deploy the database with the command, where PWORD is a unique/strong password:

docker run -d --name joomladb  -v mysql-data:/var/lib/mysql --network joomla-network -e "MYSQL_ROOT_PASSWORD=PWORD" -e MYSQL_USER=joomla -e "MYSQL_PASSWORD=PWORD" -e "MYSQL_DATABASE=joomla" mysql:5.7

How to deploy Joomla

Create the Joomla volume

Now create a volume to hold the Joomla data with the command:

docker volume create joomla-data

We’ll deploy Joomla with this command, where PWORD is the password you set in the database deployment.

docker run -d --name joomla -p 80:80 -v joomla-data:/var/www/html --network joomla-network -e JOOMLA_DB_HOST=joomladb -e JOOMLA_DB_USER=joomla -e JOOMLA_DB_PASSWORD=PWORD joomla

If port 80 is already in use, you might also have to change the port configuration. For example, you could deploy Joomla to external port 8005 with the command:

docker run -d --name joomla -p 8005:80 -v joomla-data:/var/www/html --network joomla-network -e JOOMLA_DB_HOST=joomladb -e JOOMLA_DB_USER=joomla -e JOOMLA_DB_PASSWORD=PWORD joomla

How to access the web-based installer

Point your web browser to http://SERVER:PORT, where SERVER is either the IP address or domain of the hosting server, and PORT is the external port you assigned during the deployment. You should be greeted by the web-based installer (Figure A), where you can finish the installation.

Figure A

Joomla CMS installer.

The host of the database will be joomladb because it’s been containerized and not localhost.

Congratulations! You just deployed Joomla with the help of Docker. With this process, you can deploy Joomla to any environment that supports Docker.

How to learn more about Docker

If you want to learn more about Docker, don’t miss these resources in the TechRepublic Academy:

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

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays