I'm looking to read all the host files from within my Docker container in a read-only manner. I want to be able to execute commands like `df -h` and access some scripts located on the host. I've been looking into Docker volumes and mounts but I'm not entirely sure which approach to take. Any advice?
3 Answers
Are you using Docker Desktop? That can sometimes limit what you can see depending on the setup.
To access host files from your Docker container, you need to create a host volume mount. You can do this with the command `-v /dir:/somedir:ro`, where `/dir` is the path on the host and `/somedir` is the path inside the container. This will allow you to see the files in the specified directory from the container.
Just a note, if you're able to see directories under `/dir` but not any of their subdirectories, ensure that your directory structure on the host is correct and that the right permissions are set. It's odd that you can see everything in `/var`, though.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures