How to mount a directory in the docker container to the host?

后端 未结 5 2163
广开言路
广开言路 2020-12-31 16:05

It\'s quite easy to mount a host directory in the docker container.

But I need the other way around.

I use a docker container as a development environment fo

5条回答
  •  轮回少年
    2020-12-31 16:40

    Why not just do: docker run ... -v /usr/share/wordpress/:/usr/share/wordpress. Now your local /usr/share/wordpress/ is mapped to /usr/share/wordpress in the Docker container and both have the same files. You could also mount elsewhere in the container this way. The syntax is host_path:container_path, so if you wanted to mount /usr/share/wordpress from your host to /my/new/path on the container, you'd just do: docker run ... -v /usr/share/wordpress/:/my/new/path.

提交回复
热议问题