Why Docker Compose and .env Can Break NFS Bind Mounts
Originally published at kjetilfuras.com Recently while setting up a Docker Compose-based media stack, I ran into a tricky issue. It looked like everything was working, the containers were up, the m...

Source: DEV Community
Originally published at kjetilfuras.com Recently while setting up a Docker Compose-based media stack, I ran into a tricky issue. It looked like everything was working, the containers were up, the mounts were in place, and the files were visible, yet I couldn’t write to my NFS share from inside the containers. Here’s what happened, and how I fixed it. What I Was Building I had a shared NFS mount point at /mnt/data on my Ubuntu Docker host, and I wanted to use environment variables to keep things clean: In my .env: # Data Share DATA=/mnt/data And in my docker-compose.yml: volumes: - ${DATA}:/data This approach seemed solid — clean, reusable, and friendly for future automation. What Looked Right The container started successfully The NFS share mounted properly on the host Inside the container, I could ls /data and see all my files and folders Permissions looked fine on the host: the NFS export mapped to UID/GID 1000, which matched the container user Where It Broke Despite being able to br