I'm trying to mount a writable Docker volume as a child of a read-only volume, but I get this error:
ERROR: for wordpress rpc error: code = 2 desc = "oci runtime error:
could not synchronise with container process: mkdir /mnt/sda1/var/lib
/docker/aufs/mnt/.../var/www/html/wp-content/uploads: read-only file
system"
I'm working with a WordPress image, and the two volumes I want to mount are:
The quick solution is to move uploads somewhere else, but I'd prefer a Docker solution.
Relevant bits of my docker-compose.yml:
volumes:
uploads:
driver: local
services:
wordpress:
volumes:
- /dev/workspace/wp-content/:/var/www/html/wp-content/
- uploads:/var/www/html/wp-content/uploads
Answering my own question: The mount point must exist in the Read-Only volume, even if it won't be used. Docker was trying to create the uploads directory in the RO volume before mounting it.
When I created an empty directory at /dev/workspace/wp-content/uploads, the error disappeared and everything worked as expected.
Yes, in general, you can! Here is an example with the read-only parent path
-v $DIR/htdocs:/var/www/html:ro
and another mount
-v $DIR/logs:/var/www/html/app/cache:rw
See more https://stackoverflow.com/a/37730878/4986182
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With