在docker上安装duplicator archive以进行本地wordpress开发

在docker上安装duplicator archive以进行本地wordpress开发

问题描述:

I have a live website, and I want to test something locally. With Duplicator I made a installer and locally I started a Docker Container for Wordpress. This is my docker-compose.yml:

version: "2"
services:
  my-wpdb:
    image: mariadb
    ports:
      - "8081:3306"
    environment:
      MYSQL_ROOT_PASSWORD: password
  my-wp:
    image: wordpress
    volumes:
      - ./:/var/www/html
    ports:
      - "8080:80"
    links:
      - my-wpdb:mysql
    environment:
      WORDPRESS_DB_PASSWORD: password

I copied the installer.php in the local folder and started the installation on localhost:8080/installer.php.

When I reach the page for the database connection it doesn't work, and I don't understand if what I want to achieve is not possible or I make some mistakes.

This is what I see:

And this is what I can read on dup-installer-log.txt:

INSTALLER ERROR:
*** PHP Fatal Error Message: Uncaught Error: Call to a member function options() on boolean in /var/www/html/dup-installer/classes/class.db.php:45
Stack trace:
#0 /var/www/html/dup-installer/ctrls/ctrl.s2.dbtest.php(162): DUPX_DB::connect('localhost', 'admin', 'password', NULL, '8081')
#1 /var/www/html/dup-installer/ctrls/ctrl.s2.dbtest.php(121): DUPX_DBTest->r10All(Array)
#2 /var/www/html/dup-installer/ctrls/ctrl.s2.dbtest.php(87): DUPX_DBTest->runBasic()
#3 /var/www/html/dup-installer/ctrls/ctrl.s2.base.php(92): DUPX_DBTest->run()
#4 /var/www/html/dup-installer/main.installer.php(196): require_once('/var/www/html/d...')
#5 {main}
  thrown (Code: 1, line 45 in /var/www/html/dup-installer/classes/class.db.php)

Can somebody help me?

According to your file. it should be

Host: my-wpdb Database: mysql User: root password: password

You should be using your servicename my-wpdb as the hostname for duplicator plugin.

host = servicename defined in docker-compose.yaml
Database = MYSQL_DATABASE
User = MYSQL_USER
Password = MYSQL_PASSWORD