Namran Hussin SoftwareDevelopment Docker-compose for joomla development with mysql and redis

Docker-compose for joomla development with mysql and redis

Let’s say you just want to have Joomla with its Mysql and also redis infrastructure ready.
And don’t want to bother setting it up manually for each services.

Just make a docker-compose.yaml with the following content and then start it up.


version: '3.1'

services:
  web:
    image: joomla
    restart: always
    links:
      - db:mysql
      - redis:cache
    ports:
      - "80:80"
    volumes:
      - "./html:/var/www/html"
      - "./php/php.ini:/usr/local/etc/php/php.ini"
    environment:
        JOOMLA_DB: ${MYSQL_DB}
        JOOMLA_DB_HOST: db
        JOOMLA_DB_PASSWORD: ${MYSQL_ROOT_PASSWORD}

  db:
    image: mysql:5.6
    ports:
      - "3306:3306"
    restart: always
    volumes:
      - "./mysql:/var/lib/mysql"
    environment:
        MYSQL_DATABASE: ${MYSQL_DB}
        MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}

  redis:
    image: redis
    container_name: cache
    ports:
        - "6379:6379"
    restart: always    

then create an .env file with the content for above parameters.


MYSQL_ROOT_PASSWORD=password # set to whatever here
MYSQL_DB=dbname # set approriate database name here

If you have an pre-compiled quickstart file, just extract it into `html` folder.

Then just start the docker with


docker-compose up -d

During install process at http://localhost/installation
just enter the password and db name credential similar to what have been defined in `.env` file.

Related Post