moby: Cannot mount file with number in name

Description of problem: Docker throw an error when trying to mount file with number at the end of the filename

docker version:

Client version: 1.6.2
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 7c8fca2
OS/Arch (client): darwin/amd64
Server version: 1.6.2
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 7c8fca2
OS/Arch (server): linux/amd64

docker info:

Containers: 21
Images: 293
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 335
 Dirperm1 Supported: true
Execution Driver: native-0.2
Kernel Version: 4.0.3-boot2docker
Operating System: Boot2Docker 1.6.2 (TCL 5.4); master : 4534e65 - Wed May 13 21:24:28 UTC 2015
CPUs: 4
Total Memory: 1.957 GiB
Name: boot2docker
ID: 245Y:APHH:XQNI:DUE6:S5RE:MHDE:6HML:TCZF:FQBY:MFR6:4OXA:2VCJ
Debug mode (server): true
Debug mode (client): false
Fds: 16
Goroutines: 24
System Time: Tue Jun  2 18:12:35 UTC 2015
EventsListeners: 0
Init SHA1: 7f9c6798b022e64f04d2aff8c75cbf38a2779493
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker

uname -a:

Darwin mac-mk.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

Environment details (AWS, VirtualBox, physical, etc.): Local environment (with boot2docker)

How reproducible: Always

Steps to Reproduce:

  1. touch db.sqlite3
  2. docker run -it -v $(pwd)/db.sqlite3:/root/db.sqlite ubuntu /bin/bash

Actual Results:

Code: System error

Message: not a directory

Frames:

---
0: setupRootfs
Package: github.com/docker/libcontainer
File: rootfs_linux.go@29

---
1: Init
Package: github.com/docker/libcontainer.(*linuxStandardInit)
File: standard_init_linux.go@52

---
2: StartInitialization
Package: github.com/docker/libcontainer.(*LinuxFactory)
File: factory_linux.go@223

---
3: initializer
Package: github.com/docker/docker/daemon/execdriver/native
File: init.go@35

---
4: Init
Package: github.com/docker/docker/pkg/reexec
File: reexec.go@26

---
5: main
Package: main
File: docker.go@29

---
6: main
Package: runtime
File: proc.go@63

---
7: goexit
Package: runtime
File: asm_amd64.s@2232
FATA[0000] Error response from daemon: Cannot start container 99392c205737fa025b32540628e4b79c3c9ecc2d8222b8d5f152e86eb1614ff1: [8] System error: not a directory

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 39 (11 by maintainers)

Most upvoted comments

Jumping in really late here, but like @ror6ax, the following configuration threw an error:

version: '3'
services:

  nginx:
    image: nginx
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
    ports:
      - 80:80

This is when using a docker-machine, and everything @cpuguy83 makes sense if you understand that ./nginx/nginx.conf is not a reference to your local machine, but to the docker-machine (so the file won’t exist there, a directory will be created, and docker will complain).

I think I experienced the same error, but in my case it was not directly related to having a number in the file name. I couldn’t mount a file on the host over a file in the container. Regardless of whether it existed in the container before or not.

I could fix the problem by restarting the docker machine (docker-machine restart default). What was odd was, that I was able to mount the file if I changed the filename on the host. It doesn’t matter if I included a number, it just had to be different.

Mounting ldap.properties -> ldap.properties failed. ldap.prop -> ldap.properties or foo.properties -> ldap.properties worked, even before restarting the virtual machine.

Finally I am happy after restarting the docker machine, but it seems to me that there is a relation to the involved filename? I am using Docker version 1.10.2, build c3959b1, docker-machine version 0.6.0, build e27fb87 and VirtualBox 5.0.8r103449.

Escaping the dashes fixed this for me. This is very odd. Are filenames with dashes not recommended? (e.g docker-compose-entrypoint.sh)