Home > Blockchain >  Docker Apache 2 mounting volume - prevent files from /etc/httpd directory from deletion
Docker Apache 2 mounting volume - prevent files from /etc/httpd directory from deletion

Time:10-06

I am trying to mount my custom conf files to /etc/httpd however, when I build docker compose, it will result to /etc/httpd/conf/httpd.conf No such file or Directory

Apache docker-compose:

  apache:
    container_name: apache
    image: cytopia/apache-2.2
    volumes:
      - ./src:/var/www
      - ./apache:/etc/httpd
    depends_on:
      - php
      - mysql
    ports:
      - "8088:80"
    networks:
      - project

apache directory :

- conf
- conf.d
- conf.v (virtual host)

I just want to overwrite the data inside /etc/httpd without deleting the other files/directories inside. If this is possible or not, please advice what to do. Thank you.

CodePudding user response:

You might try first and bind-mount those files individually, rather than the folder (which does override everything)

 apache:
    container_name: apache
    image: cytopia/apache-2.2
    volumes:
      - ./src:/var/www
      - ./apache/conf/aFile:/etc/httpd/conf/aFile:ro
      - ./apache/conf.d/aFile:/etc/httpd/conf.d/aFile:ro
      - ...
  • Related