{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/27408","repository_url":"https://api.github.com/repos/docker/docker","labels_url":"https://api.github.com/repos/docker/docker/issues/27408/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/27408/comments","events_url":"https://api.github.com/repos/docker/docker/issues/27408/events","html_url":"https://github.com/docker/docker/issues/27408","id":183211184,"number":27408,"title":"Docker for Windows -v mounts files as (empty) directories","user":{"login":"rbrecheisen","id":912947,"avatar_url":"https://avatars.githubusercontent.com/u/912947?v=3","gravatar_id":"","url":"https://api.github.com/users/rbrecheisen","html_url":"https://github.com/rbrecheisen","followers_url":"https://api.github.com/users/rbrecheisen/followers","following_url":"https://api.github.com/users/rbrecheisen/following{/other_user}","gists_url":"https://api.github.com/users/rbrecheisen/gists{/gist_id}","starred_url":"https://api.github.com/users/rbrecheisen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbrecheisen/subscriptions","organizations_url":"https://api.github.com/users/rbrecheisen/orgs","repos_url":"https://api.github.com/users/rbrecheisen/repos","events_url":"https://api.github.com/users/rbrecheisen/events{/privacy}","received_events_url":"https://api.github.com/users/rbrecheisen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/version/1.12","name":"version/1.12","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-10-15T14:00:49Z","updated_at":"2016-10-17T16:11:15Z","closed_at":"2016-10-15T19:50:19Z","body":"<!--\r\nIf you are reporting a new issue, make sure that we do not have any duplicates\r\nalready open. You can ensure this by searching the issue list for this\r\nrepository. If there is a duplicate, please close your issue and add a comment\r\nto the existing issue instead.\r\n\r\nIf you suspect your issue is a bug, please edit your issue description to\r\ninclude the BUG REPORT INFORMATION shown below. If you fail to provide this\r\ninformation within 7 days, we cannot debug your issue and will close it. We\r\nwill, however, reopen it if you later provide the information.\r\n\r\nFor more information about reporting issues, see\r\nhttps://github.com/docker/docker/blob/master/CONTRIBUTING.md#reporting-other-issues\r\n\r\n---------------------------------------------------\r\nBUG REPORT INFORMATION\r\n---------------------------------------------------\r\nUse the commands below to provide key information from your environment:\r\nYou do NOT have to include this information if this is a FEATURE REQUEST\r\n-->\r\n\r\n**Description**\r\n\r\nI installed Docker Toolbox for Windows and pointed the Docker Quickstart Terminal target to bash.exe of my Git installation. I'm working on the D: drive so I added a D:\\Develop shared folder to the VirtualBox default machine. I then try to run a standard MySQL container mounting 2 files that I use to initialize the database with some records. However, these files get mounted as empty directories.\r\n\r\n**Steps to reproduce the issue:**\r\n1. I run the container as follows: `docker run -d --name mydb -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=mydb -v /D/Develop/paedmorph/database/init-db.sh:/tmp/init-db.sh -v /D/Develop/paedmorph/database/init-db.sql:/tmp/init-db.sql -p 3306:3306 mysql:5.7`\r\n2. Then I open a shell to the running container `docker exec -it <id> bash`\r\n3. When I run `ls -l /tmp` I get the following output:\r\n`total 0`\r\n`drwxr-xr-x 2 root root 40 Oct 15 13:31 init-db.sh`\r\n`drwxr-xr-x 2 root root 40 Oct 15 13:31 init-db.sql`\r\n\r\n**Describe the results you received:**\r\nAs can be seen above, both files get mounted as (empty) directories. Now, I read somewhere (one of the other docker issues) that if the -v option cannot find the host directory it mounts it as an empty directory including any parent directories. I'm not sure that applies here. I initially tried to just do `-v $(pwd)/database/init-db.sh` but then I got an error about not being able to mount at all. I think that's related to the fact that `msys` (on Windows) converts the output of `$(pwd)` to a Windows path which has a colon (:) right after the drive letter and which conflicts with the colon used to separate the host and container paths. I also read you could fix that by prepending the path with an additional forward slash. That solved the mount error problem but now I'm experiencing this weird behavior with files being mounted as empty directories. I was wondering whether anybody has seen this before.\r\n\r\n**Describe the results you expected:**\r\nI expected the file to be mounted as executable files.\r\n\r\n**Additional information you deem important (e.g. issue happens only occasionally):**\r\n\r\n**Output of `docker version`:**\r\n\r\n```\r\nClient:\r\n Version:      1.12.2\r\n API version:  1.24\r\n Go version:   go1.6.3\r\n Git commit:   bb80604\r\n Built:        Tue Oct 11 17:00:50 2016\r\n OS/Arch:      windows/amd64\r\n\r\nServer:\r\n Version:      1.12.2\r\n API version:  1.24\r\n Go version:   go1.6.3\r\n Git commit:   bb80604\r\n Built:        Tue Oct 11 17:00:50 2016\r\n OS/Arch:      linux/amd64\r\n```\r\n\r\n**Output of `docker info`:**\r\n\r\n```\r\nContainers: 1\r\n Running: 1\r\n Paused: 0\r\n Stopped: 0\r\nImages: 1\r\nServer Version: 1.12.2\r\nStorage Driver: aufs\r\n Root Dir: /mnt/sda1/var/lib/docker/aufs\r\n Backing Filesystem: extfs\r\n Dirs: 13\r\n Dirperm1 Supported: true\r\nLogging Driver: json-file\r\nCgroup Driver: cgroupfs\r\nPlugins:\r\n Volume: local\r\n Network: host null bridge overlay\r\nSwarm: inactive\r\nRuntimes: runc\r\nDefault Runtime: runc\r\nSecurity Options: seccomp\r\nKernel Version: 4.4.24-boot2docker\r\nOperating System: Boot2Docker 1.12.2 (TCL 7.2); HEAD : 9d8e41b - Tue Oct 11 23:40:08 UTC 2016\r\nOSType: linux\r\nArchitecture: x86_64\r\nCPUs: 1\r\nTotal Memory: 6.067 GiB\r\nName: default\r\nID: WXRJ:LQD5:6WNC:UGQE:6TIR:RZ7S:KANK:QEX2:56B6:24NY:RDRW:QHLH\r\nDocker Root Dir: /mnt/sda1/var/lib/docker\r\nDebug Mode (client): false\r\nDebug Mode (server): true\r\n File Descriptors: 18\r\n Goroutines: 30\r\n System Time: 2016-10-15T13:36:15.330008601Z\r\n EventsListeners: 0\r\nRegistry: https://index.docker.io/v1/\r\nLabels:\r\n provider=virtualbox\r\nInsecure Registries:\r\n 127.0.0.0/8\r\n```\r\n\r\n**Additional environment details (AWS, VirtualBox, physical, etc.):**\r\n"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/254254044","html_url":"https://github.com/docker/docker/issues/27408#issuecomment-254254044","issue_url":"https://api.github.com/repos/docker/docker/issues/27408","id":254254044,"user":{"login":"rbrecheisen","id":912947,"avatar_url":"https://avatars.githubusercontent.com/u/912947?v=3","gravatar_id":"","url":"https://api.github.com/users/rbrecheisen","html_url":"https://github.com/rbrecheisen","followers_url":"https://api.github.com/users/rbrecheisen/followers","following_url":"https://api.github.com/users/rbrecheisen/following{/other_user}","gists_url":"https://api.github.com/users/rbrecheisen/gists{/gist_id}","starred_url":"https://api.github.com/users/rbrecheisen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbrecheisen/subscriptions","organizations_url":"https://api.github.com/users/rbrecheisen/orgs","repos_url":"https://api.github.com/users/rbrecheisen/repos","events_url":"https://api.github.com/users/rbrecheisen/events{/privacy}","received_events_url":"https://api.github.com/users/rbrecheisen/received_events","type":"User","site_admin":false},"created_at":"2016-10-17T16:11:15Z","updated_at":"2016-10-17T16:11:15Z","body":"As I said I did get the mount to work but now I'm experiencing another issue which I never saw before on a Mac platform (what I normally use). As I described in the very first post I mount a bash script init-db.sh in the container which I try to execute as soon as the container is running. The contents of the script are as follows\r\n\r\n`#!/usr/bin/env bash`\r\n`mysql -uroot -p\"secret\" < /tmp/db.sql`\r\n\r\nI run the container as follows:\r\n\r\n\r\n\r\n`docker run -d --name mydb -p 3306:3306 -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=mydb -v $(pwd)/database/db.sql:/tmp/db.sql -v $(pwd)/database/init-db.sh:/tmp/init-db.sh mysql:5.7`\r\n\r\nThen I run\r\n\r\n`docker exec -it <id> /tmp/init-db.sh`\r\n\r\nin order to initialize the database with the db.sql file. However, I get an error \": No such file or directory\" (note the colon at the beginning). If I open up a bash shell in the container and then run the script, it runs fine. My feeling is the script can't find the db.sql file in /tmp but I'm not sure. Could this have something to do with the fact that I'm not specifying any uid/gid when mounting the d/Develop folder? So it might be some permissions problem?"}}
{"actor":{"display_login":"rbrecheisen"}}