Is there a way to share folder from docker container to host?
For example I have tomcat inside docker container and I want it to be visible from the outside.
If I do volumes: - /opt/tomcat:/opt/tomcat
I receive an error in the container: "No such file or directory /opt/tomcat/bin/catalina.sh"
I don't think Docker allows you to that. That command will mount your host folder in the container, so your files in the container are not visible anymore.
Two options:
You can access the container files using this trick (GitHub issue):
sudo ls /proc/$(docker inspect --format {{.State.Pid}} YOUR_CONTAINER_NAME)/root
. To access them you will need root privileges, or you can use bindfs to match root user with your user name (see the same thread).Create a new volume, copy the files you need to be accessible to there and mount it inside the container, in the right place