0

I had a Docker container with a folder mounted in it from the host (noureldin.local.crt is a folder):

etc/ssl/CA/ICA01/keys/noureldin.local.crt:etc/ssl/samba.crt:ro

and then I deleted that folder from the host and created a file with exactly the same name instead of the folder in the same path (noureldin.local.crt now is a file), and then restarted the container, but now the container cannot be started because docker tells that this is not a folder, with this error:

d241b7e25143187fbf8258a664f5d409d1abd4d9578f045cb493df26ed204d46
docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"process_linux.go:359: container init caused \\\"rootfs_linux.go:53: mounting \\\\\\\"/etc/ssl/CA/ICA01/keys/noureldin.local.crt\\\\\\\" to rootfs \\\\\\\"/var/lib/docker/overlay/8888974e268a54dafd22ccb2d05f9cd33da4bfa70d3ee1df0070fcc8c804c411/merged\\\\\\\" at \\\\\\\"/var/lib/docker/overlay/8888974e268a54dafd22ccb2d05f9cd33da4bfa70d3ee1df0070fcc8c804c411/merged/etc/ssl/samba.crt\\\\\\\" caused \\\\\\\"not a directory\\\\\\\"\\\"\"\n".

and here I tried to delete that path I see in the error from overlay folder, but always I get the same error with a new created paths. (I know I should have not deleted anything manually).

After that I tried again to restore folders with the same names instead of the files (just like the first step). but now the container doesn't start and exits with error 126.

I tried to delete and then recreate the container but I always get that error (it is something related with the path I am mounting from the host).

Could someone help me to solve that problem (I want to keep the paths the same).

Mohammed Noureldin
  • 14,913
  • 17
  • 70
  • 99

1 Answers1

0

I tried to reproduce this using Docker version 1.12.3 (see shell output below). Removing the directory and replacing it with a file caused the same error. However, once I removed the file and put the directory back I was able to restart the container. The directory was also re-created.

The only thing I could see being different between what you did and what I did is it looks like you're using relative paths for your volume (which I didn't think was supported), or it could be a copy/paste thing where leading / got dropped. The directory name/path is also different, but that also shouldn't make a difference.


~/work ᐅ mkdir ttt
~/work ᐅ docker run -itd -v $(pwd)/ttt:/ttt/ssl/samba.crt:ro ubuntu /bin/bash                                   2dc4fe36b2d4bf73a019160437a9f64501b05bb54ed7dc74d5b5f6b487171f27
~/work ᐅ rm -rf ttt
~/work ᐅ touch ttt
~/work ᐅ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
2dc4fe36b2d4        ubuntu              "/bin/bash"         25 seconds ago      Up 24 seconds                           mad_boyd
~/work ᐅ docker restart mad_boyd
Error response from daemon: Cannot restart container mad_boyd: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"process_linux.go:359: container init caused \\\"rootfs_linux.go:53: mounting \\\\\\\"/home/roman/work/stackoverflow/volume-stuff/ttt\\\\\\\" to rootfs \\\\\\\"/var/lib/docker/aufs/mnt/ddb94bac7c9f1fa43165b514e84f2584887040b04e42748cfa06011113514d30\\\\\\\" at \\\\\\\"/var/lib/docker/aufs/mnt/ddb94bac7c9f1fa43165b514e84f2584887040b04e42748cfa06011113514d30/ttt/ssl/samba.crt\\\\\\\" caused \\\\\\\"not a directory\\\\\\\"\\\"\"\n"
~/work ᐅ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
~/work ᐅ rm ttt
~/work ᐅ docker start mad_boyd 
mad_boyd
~/work ᐅ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
2dc4fe36b2d4        ubuntu              "/bin/bash"         56 seconds ago      Up 1 seconds                            mad_boyd
~/work ᐅ ls
ttt
Roman
  • 19,581
  • 6
  • 68
  • 84