0

I’m trying to run Docker inside Docker. I’m running the first container on AWS ECS, with task definition that contain “volumes” and "mountPoints" as described below, with CentOS 7 image.

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

    "volumes": [
    {
      "name": "recording",
      "host": {
      "sourcePath": "/recording"
      }
    }
 ]

When this container is up, I’m installing “docker-ce” and then runs new container inside of it, trying to upload “kurento-media-server“ Ubuntu 14.4 image (https://hub.docker.com/r/kurento/kurento-media-server/ ).

Inside the Docker runs the command:

“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”

The docker exited right away with code 0, no errors on docker log.

Running with --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”

The container is running but the mount is not established (when running “docker inspect” the “Mount” section is empty, when getting inside the docker –the mounted directory is not exist).

The path on the host "/usr/share/rec/myApp" exist as weel as the container path "/usr/share/".

Docker version: Docker version 17.09.0-ce, build afdb6d4

I really would appreciate any help and insight on how to get this to work.

Thank you in advance.

shani
  • 51
  • 1
  • 7
  • 1
    I think you can read this https://stackoverflow.com/questions/31381322/docker-in-docker-cannot-mount-volume – Kilian Dec 07 '17 at 12:19
  • If you have fully installed doker inside the parent container and running in the container with`--mount type=bind,source=/usr/share/rec/myApp ,target=/usr/share/myApp`, this means that `/usr/share/rec/myApp` should exist inside the parent container. – yamenk Dec 07 '17 at 12:29
  • @yamenk yes, the parent container has the path /usr/share/rec/myApp – shani Dec 07 '17 at 13:34
  • @Kilian this is not my case, i'm not mounting the /var/run/docker.sock and in my case the volume is not mounted at all – shani Dec 07 '17 at 13:36

1 Answers1

0

Solved the issue! The problem was with the command arguments order, the --mount should be writen before the docker image name. I ended up with this command:

    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
shani
  • 51
  • 1
  • 7