Let's say I have a directory /var/www/html inside the container. I want to view it's contents outside in let's say ~/my_user/sites ( folder sites is not yet created ). I know I can use the volume mapping in docker-compose as follows-
volumes:
- ~/my_user/sites:/var/www/html
But whenever I do this, the directory /var/www/html inside the container is mounted to an empty directory, therefore itself become empty. I know that this is how mounting is supposed to work but isn't there a way by which I can get access to the contents of the container in the host directory structure itself.
Also, if you have an easy workaround this then please mention that.