为什么我可以用 docker 安装任何点

how come i can mount any point with docker

所以检查这个命令:

docker container run -v test_node:/my_app_1 -p 3333:3000 --name test2 node:8.13.0

我的问题是 test_node:/my_app_1 卷安装为什么没有导致错误,我的意思是它不可能是 node:8.13.0 中的卷,而且我没有使用自定义Dockerfile,

另外,/my_app_1文件夹怎么会自动生成。据我所知,如果你想挂载一个特定的位置,你需要在 Dockerfile

中使用 RUN mkdirVOLUME 命令

PS:同样的问题也适用于绑定挂载,$(pwd):/my_app_1 也能正常工作。

谢谢!

来自 docker documentation 绑定安装:

If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory.