DEV Community

Cover image for docker-compose and duplicator plugin from WordPress
Ismael Garcia
Ismael Garcia

Posted on • Updated on

docker-compose and duplicator plugin from WordPress

Small video for those that wants to use docker or docker-compose with the Duplicator WordPress plugin, for local theme or plugin development.

I found my self facing the problem that I was helping a non-profit organization to update their WordPress theme and make small changes in the PHP, CSS code.

And I wanted to host it locally and test my changes, but they have the duplicator plugin installed and backups files from it.

The issue that I face was that I couldn't link the docker db service to the duplicators host input.

The first thing that I try was to bind my docker db service to my localhost, but there was just a small issue with that I have a small project running in the background for my to-dos and other personal things that use MySQL and the port was already in use do my docker-compose
Services didn't want to start because of the same port binding.

I was looking around for a better solution, then I remember that the WordPress service was in the same container as the db service.

So I just pass the service name to the duplicators input and that solve my problem.

But I look around, and I didn't find anything that could help me before, so that is why a make the video.

For the future me, I know that I will find this issue in the future
https://m.youtube.com/watch?feature=youtu.be&v=keOlz9swqds

The docker-compose yml file is the fallowing :

version: '3'
services:
   db:
     image: mariadb
     ports:
       - "3306:3306"
    #  volumes:
    #    - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: leamsigccom
       MYSQL_DATABASE: wordpress
       MYSQL_USER: leamsigccom
       MYSQL_PASSWORD: leamsigccom
   pma:
    image: phpmyadmin/phpmyadmin
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      MYSQL_ROOT_PASSWORD: leamsigccom
    ports:
      - 8080:80
    links:
      - db:db
   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8000:80"
     restart: always
     volumes:
       - .:/var/www/html/
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: leamsigccom
       WORDPRESS_DB_PASSWORD: leamsigccom
volumes:
  db_data:



Enter fullscreen mode Exit fullscreen mode

Top comments (0)