1

My docker-compose.yml (for Immich, in case it's important) contains this:

volumes:
  - ${UPLOAD_LOCATION}:/usr/src/app/upload
  - /etc/localtime:/etc/localtime:ro
  - /data/NAS_Photos:/mnt/NAS_Photos:ro   # <-- The one I'm having trouble with

The intention (for the avoidance of doubt) is to make /data/NAS_Photos from my host available inside the container at /mnt/NAS_Photos.

When I docker-compose up -d the relevant container has a directory /mnt/NAS_Photos but mount | grep -i mnt shows

none on /mnt/NAS_Photos type tmpfs (ro,relatime,inode64)

Additionally the directory is almost empty. It does not contain the contents of my /data/NAS_Photos. (It does contain a few leftover files from previous attempts to debug this, and if I move the mount to a different location inside the container the leftover files appear there too. These files persist if I docker compose down and docker compose up.)

Why would this not be mounted, or, how can I debug why it isn't mounted? No error messages are given that I can see.

Using Ubuntu Server 22.04.3 LTS.

What I have checked:

  • /data is owned by my user, and permissions on it, and /data/NAS_Photos are both 777.

  • I can mount a directory in the same location as the docker-compose.yml without a problem.

  • The output of docker inspect -f '{{ .Mounts }}' immich_microservices is:

    [{bind /home/mark/Immich/library /usr/src/app/upload rw true rprivate} {bind /etc/localtime /etc/localtime ro false rprivate} {bind /data/NAS_Photos /mnt/NAS_Photos ro false rprivate}]

Thanks in advance!

Mark Smith
  • 1,283
  • 1
  • 11
  • 22

1 Answers1

1

The problem turned out to be with Snapd, of all things.

Docker was installed as a Snap, and Snaps have limited access to the host filesystem (discussed here). My media was in a directory not accessible by Snaps, and therefore Docker (installed as a snap) could not see it.

My (somewhat hacky) workaround was to bind-mount the media into my home directory.

Mark Smith
  • 1,283
  • 1
  • 11
  • 22
  • Interesting. I would advice you to install Docker from the repos instead, so nice I believe snap limitations aren't well suited for Docker use. – Artur Meinild Dec 29 '23 at 11:40