在Docker中运行Docker时无法挂载卷

我试图在Docker里面运行Docker。 我运行的是AWS ECS上的第一个容器,其中的任务定义包含如下所述的“卷”和“安装点”,以及CentOS 7映像。

"mountPoints": [ { "readOnly": null, "containerPath": "/usr/share/rec/screenrecordings", "sourceVolume": "recording" } ], "volumes": [ { "name": "recording", "host": { "sourcePath": "/recording" } } ] 

当这个容器启动时,我正在安装“docker-ce”,然后在里面运行新的容器,尝试上传“kurento-media-server”Ubuntu 14.4镜像( https://hub.docker.com/r/ kurento / kurento-media-server / )。

在Docker里面运行命令:

 “docker run -h my-app --name my-app -d <ECR repo end point>/image:latest --privileged -v /usr/share/rec/myApp:/usr/share/myApp --rm=true” 

docker工人立即退出码0,docker日志没有错误。

以–mount运行:

 “docker run -h my-app --name my-app -d <ECR repo end point>/image:latest --privileged --mount type=bind,source=/usr/share/rec/myApp ,target=/usr/share/myApp --rm=true” 

容器正在运行,但没有build立安装(当运行“docker inspect”时,“Mount”部分是空的,进入Docker内部时,挂载的目录不存在)。

主机“/ usr / share / rec / myApp”上的path与容器path“/ usr / share /”一样存在。

Docker版本 :Docker版本17.09.0-ce,生成afdb6d4

我真的很感激任何帮助和洞察力如何得到这个工作。

先谢谢你。

解决了这个问题! 问题出在命令参数顺序上, – docker映像名称前应该写–mount。 我结束了这个命令:

  docker run -d -h my-app --name my-app --mount type=bind,source=/usr/share/rec/myApp ,target=/usr/share/myApp <ECR repo end point>/image:latest --privileged --rm=true