简体   繁体   中英

How to mount a host volume from dockerfile

I was trying to mount host volume(windows 10) from dockerfile. I was using the command:

docker run -v <host-dir>:<container-dir> <image-name>

from docker terminal. It was working fine from docker terminal. But when I tried to do the same from dockerfile execution it's getting stopped because of this command. Please help how to mount host volume from dockerfile.

What exactly have you written in your Dockerfile?

For Dockerfiles there exists a VOLUME instruction, which can probably help you.

I recommend reading the following 2 links for clarification on Docker volumes:

Official Docker documentation

Helpful blogpost

Edit: I may have found another post which could help you immensely: Docker volume and mount

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