docker-library / docker-library/drupal

docker: drupal site doesnt survive a restart

Open
#227 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
291
Forks
199
Avg merge
5h 12m
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided docker-compose configuration and the commands used to copy and mount /var/www/html/sites. Check how the Drupal and PostgreSQL containers handle their data across a restart. Done means the existing site and its content return after restarting the containers instead of showing the installation page.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, postgres
Domain
backend, databases, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.