Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Deploy Joomla Through Docker

Docker Compose File

Create a docker-compose.yml file with the following content:

services:
  joomla:
    image: joomla:5.1-php8.2-apache
    restart: always
    ports:
      - "80:80"
    volumes:
      - joomla-data:/var/www/html
    environment:
      - JOOMLA_DB_HOST=db
      - JOOMLA_DB_USER
      - JOOMLA_DB_PASSWORD

  db:
    image: mysql:8.0
    restart: always
    volumes:
        - db-data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD
      - MYSQL_DATABASE=joomla
      - MYSQL_USER=${JOOMLA_DB_USER}
      - MYSQL_PASSWORD=${JOOMLA_DB_PASSWORD}

volumes:
  joomla-data:
    driver: local
  db-data:
    driver: local

Create The Env File

Create a .env file at the same location as the docker-compose.yml file you just created.

COMPOSE_PROJECT_NAME="joomla"


# Specify the root password for the mysql database.
MYSQL_ROOT_PASSWORD="putAStrongRandomPasswordHere"


# Specify the MySQL login details for the joomla user.
JOOMLA_DB_USER="joomla"
JOOMLA_DB_PASSWORD="putAStrongRandomPasswordHere"
Last updated: 22nd May 2024
First published: 22nd May 2024

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch