Skip to content

Multisite configuration does not work across restarts #180

@rytmis

Description

@rytmis

Overview

  • I have MULTISITE: 'true' defined in my docker-compose.yml. On the first start, multisite is enabled correctly. On subsequent starts I get a "The network already exists" message in the output, but wp-config.php is generated without the multisite constants, so WordPress admin tells me multisite support is not enabled.
  • Windows 10 20H2 (OS Build 19042.867)
  • Docker version 20.10.5
  • Workaround: run docker-compose down -v and start with a blank database every time (not ideal).

docker-compose.yml

version: '3'
services:
  wordpress:
    cap_add:
      - SYS_ADMIN
    devices:
      - /dev/fuse
    image: visiblevc/wordpress:latest
    ports:
      - 9000:80
      - 44300:443
    volumes:
      - ./plugins:/app/wp-content/plugins
      - ./install-dev-plugins:/docker-entrypoint-initwp.d/install-dev-plugins
      - ./custom-block-types:/app/wp-content/plugins/custom-block-types
    environment:
      DB_HOST: db # must match db service name below
      DB_NAME: wordpress
      DB_PASS: root # must match below
      URL_REPLACE: localhost:9000
      WP_DEBUG: 'true'
      MULTISITE: 'true'
        
    extends:
      service: localConfig
      file: docker-compose.local.yml
  db:
    image: mysql:5.7 # or mariadb:10
    volumes:
      - data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
volumes:
  data: {}

docker-compose.local.yml

version: '3'
services:
  localConfig:
    environment:
      EXTRA_PHP: |
        define('WP_MEMORY_LIMIT', '128M');
        define('<plugin-specific-constant>', '<secret>');

docker-compose up output

wordpress_1  | ======================================================================
wordpress_1  |                     Begin WordPress Installation
wordpress_1  | ======================================================================
wordpress_1  | ==> Waiting for MySQL to initialize...
wordpress_1  | ==> Configuring WordPress
wordpress_1  | Success: Generated 'wp-config.php' file.
wordpress_1  | ==> Checking database
wordpress_1  | ==> Enabling Multisite
wordpress_1  |          The network already exists.
wordpress_1  | ==> Checking themes
wordpress_1  | ==> Checking plugins
wordpress_1  | ==> Finalizing
wordpress_1  | ==> Executing user init scripts
wordpress_1  | ======================================================================
wordpress_1  |                   WordPress Installation Complete!
wordpress_1  | ======================================================================

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions