在Docker中运行Docker时无法安装卷

问题描述 投票:0回答:1

我正在尝试在Docker中运行Docker。我在AWS ECS上运行第一个容器,其任务定义包含如下所述的“volumes”和“mountPoints”,以及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 log上没有错误。

使用--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”

容器正在运行但挂载未建立(当运行“docker inspect”时,“Mount”部分为空,当进入docker时 - 挂载的目录不存在)。

主机“/ usr / share / rec / myApp”上的路径以容器路径“/ usr / share /”的形式存在。

Docker版本:Docker版本17.09.0-ce,构建afdb6d4

我真的很感激有关如何使其发挥作用的任何帮助和见解。

先感谢您。

docker
1个回答
0
投票

解决了这个问题!问题在于命令参数顺序, - mount应该在docker镜像名称之前写入。我最终得到了这个命令:

    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
© www.soinside.com 2019 - 2024. All rights reserved.