I am new to Docker. I have run a web server on Docker, which creates files as per user request. While the Docker is running I want to view and read those files from Docker container. How can I do it from host ?
You can first execute a shell inside your running container :
docker exec -i -t your_container /bin/sh
Then, from here, you should be able to view/read files existing inside the container.
If you want to access your files directly from your host, you can use volumes . For example, run your container like :
docker run -d \
-v /path/on/your/host:/path/on/your/container \
your_webserver_image
Then, created files inside your container (on folder /path/on/your/container
) will then be accessible from your host (folder /path/on/your/host
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.