简体   繁体   中英

Read outside container Docker

How can I read a file in outside of docker container?

For example: I have a file asd.txt in /etc/share/example/asd.txt in my server machine and I need to access this into my docker container.

It's possible?

Mount the path as a volumne and you can access it in your container:

docker run -v /etc/share/example/:<destination>:ro ... 

For more informations see: https://docs.docker.com/storage/volumes/

您将要研究在容器中装入一个卷

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM