Reputation: 1257
I want to mount a volume to the the user's home directory inside my Docker container. Inside my docker-compose.yml
file I have the following Volumes property specified
volumes:
- ./conf:$HOME/conf
I would expect this to mount the volume to /root/conf
but that doesn't appear to happen. Does Docker/Docker Compose not support environment variable substitution in volume paths? Is there a way I can mount the volume to the user's home directory without having to know that the home directory is /root inside the container?
Upvotes: 15
Views: 30822
Reputation: 1257
As @Michael mentions in the comments I can use the USER command to ensure that a specific user is used when running the app in the container. This will allow me to mount the volume to that users home directory and guarantee that the correct files are in place for my app.
Upvotes: 3