I’m sure what I’m doing has a simple solution, but I’m pulling my hair out trying to find it.
I’m running the wordpress (on apache) and mysql images in docker-compose. I’ve mounted the directories I believe are appropriate ( “/var/ww/html” and “etc/apache2/sites-available” ). so I may modify them outside the containers, and everything connects when I spin it up. The only issue is I have to manually enter the wordpress container and enable all my virtualhosts file via ‘a2ensite’. I’ve tried using bash scripts to run these commands via ‘docker exec’ and repeatedly get “site [SITENAME] does not exist” error. I added a bash script inside the container and tried running that the same way, with the same results. I figured I can mount the “/” directory of the container to my host machine but docker-compose complains when I try. Is there a better way of accomplishing this?
My docker-compose file:
version: '3.1' services: wordpress_ajh: container_name: wp_ajh image: localhost:5000/wp_ajh:latest restart: always ports: - '80:80' - '443:443' volumes: - /ajh/wp/html/:/var/www/html/ - /ajh/wp/sites-available/:/etc/apache2/sites-available/ mysql: container_name: db_ajh image: localhost:5000/db_ajh:latest restart: always volumes: - /ajh/db/:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: [REDACTED] MYSQL_USER: root
Docker version 18.06.0-ce, build 0ffa825
docker-compose version 1.22.0, build f46880fe
Linux debian-vps 4.9.0-7-amd64 #1 SMP Debian 4.9.110-1 (2018-07-05) x86_64 GNU/Linux