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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With