Skip to content

docker: drupal site doesnt survive a restart #227

@jhjacobs81

Description

@jhjacobs81

Hello,

i use this docker image to run a container from: https://hub.docker.com/_/drupal
i have then run this command: docker run --rm drupal tar -cC /var/www/html/sites . | tar -xC /path/on/host/sites and mounted it as /var/www/html/sites

However, when the container gets restarted, it shows the installation page instead of the site with its content.

Does anyone know what i do wrong? I would expect the site returns to its normal status as there's site specific data in the sites folder thats beeing mounted.

here is my docker-compose file for completeness:

 version: '3'

services:

  drupal:
    container_name: <CONTAINERNAME>
    image: drupal:9.3-php8.0
    ports:
      - 8081:80
    volumes:
      - ./modules:/var/www/html/modules
      - ./profiles:/var/www/html/profiles
      - ./themes:/var/www/html/themes
      - ./sites:/var/www/html/sites
    restart: always
    networks:
      - drupal-network

  postgres:
    image: postgres:11
    container_name: <CONTAINERNAME>
    environment:
      POSTGRES_PASSWORD: <PASSWORD>
      POSTGRES_DB: drupal
      POSTGRES_USER: drupal
    restart: always
    networks:
      - drupal-network

networks:
    default:
        driver: bridge
    drupal-network:
        external: true

## EXECUTE THIS COMMAND FIRST: docker run --rm -v /opt/docker/drupal/sites:/temporary/sites drupal cp -aRT /var/www/html/sites /temporary/sites

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions