How to deploy Joomla with Docker

Follow this step-by-step guide to quickly deploy a containerized version of Joomla – with the help of Docker.

Illustration: Lisa Hornung/TechRepublic

Joomla is a world-class open source content management system, search engine and mobile friendly, multilingual and flexible. it also offers unlimited design potential. With over 110 million downloads, over 10,000 extensions and templates, Joomla is used on over 2 million websites. You can deploy Joomla for corporate 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 just do that.

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

What you will need to deploy Joomla with Docker

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

How to install Docker

Install Docker

We go the simple route and install Docker from the default repositories. Connect to 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 extract the images

Create a new Docker network

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

docker network create joomla-network

Next, grab 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 will 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 will deploy Joomla with this command, where PWORD is the password you set when deploying the database.

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 may also need to change the port configuration. For example, you can deploy Joomla on 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 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 deployment. You should be greeted by the web installer (Figure A), where you can complete the installation.

Figure A

Joomla CMS installer.

The database host will be joomladb as it was containerized and not localhost.

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

Subscribe to TechRepublic How to make technology work on YouTube for all the latest tech tips for professionals from Jack Wallen.


Source link

Steven L. Nielsen