Can I have a writable Docker volume mounted under a read-only volume?

I am trying to set a Docker writable volume as a read-only child, 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 am working with a WordPress image, and the two volumes I want to install are:

  • / var / www / html / wp-content: contains my development code. Read only, as I don't want any unexpected changes.
  • / var / www / html / wp-content / uploads: files that are uploaded by users. Must be writable.

A quick solution is to move the downloads to another location, but I would prefer a Docker solution.

The corresponding bits of my docker-compose.yml are:

volumes:
  uploads:
    driver: local

services:
  wordpress:
    volumes:
      - /dev/workspace/wp-content/:/var/www/html/wp-content/
      - uploads:/var/www/html/wp-content/uploads 
+4
source share
2 answers

, , !

-v $DIR/htdocs:/var/www/html:ro

-v $DIR/logs:/var/www/html/app/cache:rw

fooobar.com/questions/1644736/...

+5

: , . Docker RO .

/dev/workspace/wp -content/uploads, , , .

, , , , - .

+5

All Articles