Docker volumes with subdirectories on different mountpoints

24 views Asked by At

Maybe I am not fluent enough to make this search but I think there is something I don't understand or this is not a supported thing.

I have an application that runs as a docker image. It creates a folder structure on my host to store its files but some of those folders are for temporary files and I would like to have them stored on a high speed disk somewhere else on my host. For example, my docker-compose might look like this:

`

emby:
  image: emby/embyserver
  container_name: emby
  environment:
    - "UID=${PUID}"
    - "GID=${PGID}"
    - "TZ=${TIMEZONE}"
  volumes:
    - "${ROOT}/emby/config:/config"
    - "/mnt/temp/cache:/config/cache"
    - "/mnt/media:/mnt/media"
  ports:
    - "8920:8920"
  restart: unless-stopped

`

Hopefully it is obvious I am trying to map the image's cache subfolder out to a mountpoint called /mnt/temp/cache but docker-compose seems to ignore this, sometimes only ( I do get files in both locations, strangely).

This is just an example and the question is 100% about docker, not Emby. So assume in this case, the application does not allow me to change where it places the cache subfolder and it has to be a child of config.

Is there a way to make /config/cache go to another mount point? Maybe I have made a mistake someplace as I am self taught and work alone on this.

Many thanks

I have tried to play with the formatting as suggested elsewhere on this site, for example to place a trailing slash, play with the order of the volumes directive, checked permissions, mount order etc. all to no avail.

I expect only the images cache subfolder to be redirected to the hosts /mnt/temp/cache subfolder.

0

There are 0 answers