Docker Community Forums

Share and learn in the Docker community.

[SOLVED] Volume mapping turns file into directory

(Jakob Løkke Madsen) #1

EDIT: This was an error on my part. I was running “docker run” from the wrong directory.

Expected behavior

Mounted volume files should not be ‘converted’ to folders in the container

Actual behavior

Files in volumes are interpreted as folders


  • the output of:

    • pinata diagnose -u on OSX
      OS X: version 10.11.4 (build: 15E65) version v1.11.1-beta10
      Running diagnostic tests:
      [OK] docker-cli
      [OK] Moby booted
      [OK] driver.amd64-linux
      [OK] vmnetd
      [OK] osxfs
      [OK] db
      [OK] slirp
      [OK] menubar
      [OK] environment
      [OK] Docker
      [OK] VT-x
      Docker logs are being collected into /tmp/20160505-001919.tar.gz
      Most specific failure is: No error was detected
      Your unique id is: E334122F-B0E4-478E-8EFF-8B164AAEA5DF
      Please quote this in all correspondence.
  • host distribution and version: OSX 10.11.4

Steps to reproduce the behavior

  1. Prepare local folder ‘./nginx/’ that contains an nginx.conf file.
  2. Run container with volume mapping: docker run -it -v ${PWD}/nginx:/etc/nginx --name server ubuntu
  3. in the container, cd to /etc/nginx
  4. cat nginx.conf
  5. Error: “cat: nginx.conf: Is a directory”