Hi all,
I've read a bunch of tickets about how it's possible to mount the wp-config.php file, but I've encountered a failure trying to do so.
The issue is, I'm mounting only the wp-config.php file. I get the following error:
Complete! WordPress has been successfully copied to /var/www/html
sed: cannot rename ./sedHyWkku: Device or resource busy
exited with code 4
This is my docker-compose.yml
version: '3'
services:
mysql:
container_name: sns-db
image: mariadb
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: wp
wordpress:
container_name: sns-wp
image: "wordpress:latest"
depends_on:
- mysql
ports:
- "80:80"
- "443:443"
environment:
WORDPRESS_DB_PASSWORD: wp
volumes:
- ./wp-config.php:/var/www/html/wp-config.php
volumes:
db_data:
I'm thinking that maybe the if [ ! -e wp-config.php ]; then line should come before the sed? I don't know enough about it to be sure what that does tho.
Sorry for the delay!
I see you're also specifying WORDPRESS_DB_PASSWORD: wp -- any particular reason? (by providing that environment variable, you're telling the image entrypoint script that you'd like it to update wp-config.php for you, which it sounds like is not at all what you want it to do, so removing that environment variable might be the simplest solution to your problem)
Oh, hahaha. It didn't occur to me that leaving environment blank would skip the config setup. I'll try that next time!
I have the same problem; I am trying to use a custom wp-config.php because of a multisite setup.
@frafra I got around the issue by avoiding setting any environment variables (as @tianon suggested), which is OK since the only use of setting those variables is to print them to the wp-config.php which you would do manually if using a custom one.
Sorry for the delay!
I see you're also specifying
WORDPRESS_DB_PASSWORD: wp-- any particular reason? (by providing that environment variable, you're telling the image entrypoint script that you'd like it to updatewp-config.phpfor you, which it sounds like is not at all what you want it to do, so removing that environment variable might be the simplest solution to your problem)
Saved my day, thanks!
I think the best way, is to map entire folder, and exclude subfolders
https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
Or, if you want, just do like me to map parent folder to another especific folder, and the rest to a global folder :D
# Wordpress
clientejosewp:
depends_on:
- db
image: wordpress:latest
ports:
- '8001:80'
restart: always
volumes:
- ${PWD}/wordpresses/users/clientejosewp:/var/www/html
- ${PWD}/wordpresses/wp-content:/var/www/html/wp-content
- ${PWD}/wordpresses/wp-admin:/var/www/html/wp-admin
- ${PWD}/wordpresses/wp-includes:/var/www/html/wp-includes
- ${PWD}/wordpresses/users/clientejosewp/wp-content/plugins:/var/www/html/wp-content/plugins
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DB_NAME: clientejosewp
networks:
- wpsite
Most helpful comment
Sorry for the delay!
I see you're also specifying
WORDPRESS_DB_PASSWORD: wp-- any particular reason? (by providing that environment variable, you're telling the image entrypoint script that you'd like it to updatewp-config.phpfor you, which it sounds like is not at all what you want it to do, so removing that environment variable might be the simplest solution to your problem)