How to mount a host directory in a Docker container

后端 未结 25 1294
庸人自扰
庸人自扰 2020-11-22 12:43

I am trying to mount a host directory into a Docker container so that any updates done on the host is reflected into the Docker containers.

Where am I doing somethin

25条回答
  •  情歌与酒
    2020-11-22 13:23

    I found that any directory laying under system directive like /var, /usr, /etc could not be mount under the container.

    The directive should be at user's space -v switch instructs docker daemon to mount local directory to the container, for example:

    docker run -t -d -v /{local}/{path}:/{container}/{path} --name {container_name} {imagename}
    

提交回复
热议问题