docker mounting volumes on host

前端 未结 6 616
陌清茗
陌清茗 2020-11-28 18:34

I have successfully been able to share folders between a docker container with volumes using

docker run -v /host/path:/container/path ...

B

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 18:54

    This is from the Docker documentation itself, might be of help, simple and plain:

    "The host directory is, by its nature, host-dependent. For this reason, you can’t mount a host directory from Dockerfile, the VOLUME instruction does not support passing a host-dir, because built images should be portable. A host directory wouldn’t be available on all potential hosts.".

提交回复
热议问题