Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File volume is mounted as a directory #22016

Closed
animir opened this issue Apr 14, 2016 · 7 comments
Closed

File volume is mounted as a directory #22016

animir opened this issue Apr 14, 2016 · 7 comments

Comments

@animir
Copy link

animir commented Apr 14, 2016

$  docker version
Client:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 15:54:52 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 21:49:11 2016
 OS/Arch:      linux/amd64

$ docker info
Containers: 4
 Running: 1
 Paused: 0
 Stopped: 3
Images: 11
Server Version: 1.10.3
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 77
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Plugins: 
 Volume: local
 Network: bridge null host
Kernel Version: 4.1.19-boot2docker
Operating System: Boot2Docker 1.10.3 (TCL 6.4.1); master : 625117e - Thu Mar 10 22:09:02 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 996.1 MiB
Name: default
ID: 56FB:S4NC:JYP6:HSSO:YFOA:IIPU:RTBB:SXRZ:DKT4:U5W3:7ZEK:ZQ7P
Debug mode (server): true
 File Descriptors: 26
 Goroutines: 30
 System Time: 2016-04-14T00:53:51.325242691Z
 EventsListeners: 0
 Init SHA1: 
 Init Path: /usr/local/bin/docker
 Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
 provider=virtualbox

 docker run \
            --name "test" \
            --link testdevdb:mysql \
            -v ${TESTSOURCEDIR}/site:/var/www \
            -v ${CLIENT_SPECIFIC_DATA_PATH}/html:/var/www/html/csda \
            -v {CLIENT_SPECIFIC_DATA_PATH}/connections/config.php:/var/www/connections/config.php \
            -v ${CLIENT_SPECIFIC_DATA_PATH}/html/.htaccess:/var/www/html/.htaccess \
            -v ${CLIENT_SPECIFIC_DATA_PATH}/html/.user.ini:/var/www/html/.user.ini \
            -v ${TESTSOURCEDIR}/docker/assets/php.ini:/usr/local/etc/php/php.ini \
            ${TEST_ENV} \
            -d -p 8080:80 appsrvr/test

TEST_ENV is empty for test.
TESTSOURCEDIR and TESTSOURCEDIR are full absolute paths

$ uname -a
Linux Setori 3.13.0-83-generic #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Result is:
[Thu Apr 14 00:20:03.903002 2016] [core:error] [pid 10] AH00554: Access to file /var/www/html/.htaccess denied by server: not a regular file

@animir animir changed the title File volume mounted as a directory File volume is mounted as a directory Apr 14, 2016
@cpuguy83
Copy link
Member

If the file does not exist on the host side, a dir is created and that is what is mounted in.
Also note that host mounts are relative to the docker daemon, not the docker client.

@animir
Copy link
Author

animir commented Apr 14, 2016

@cpuguy83

If the file does not exist on the host side

But the files are exists, I doublechecked it.

Also note that host mounts are relative to the docker daemon, not the docker client.

Could you give me a link to read about it or give an example?
Thanks.

@cpuguy83
Copy link
Member

@animir I don't know what the values of your env vars are, but the paths provided must be absolute and the paths must be there on the host where the docker daemon is running.

@animir
Copy link
Author

animir commented Apr 14, 2016

@cpuguy83

I don't know what the values of your env vars are, but the paths provided must be absolute and the paths must be there on the host where the docker daemon is running.

Yes, I checked it, all right.
Any other ideas?

@cpuguy83
Copy link
Member

@animir That's all it would be.
If the docker daemon does not see files there, it creates dirs and mounts dirs.
For compose, if you are using relative paths, you must use ./ as a prefix, otherwise you will get a named volume instead of a bind mounted path.

@thaJeztah
Copy link
Member

@animir looking at your setup, I see you're using boot2docker (Kernel Version: 4.1.19-boot2docker), but your host is Linux? (Linux Setori 3.13.0-83-generic); are you running VirtualBox on linux to run boot2docker? If so; did you set up VirtualBox filesharing to give the VirtualBox VM (in which the daemon runs) access to the files on your Linux host?

Any reason you're running docker inside a VM, and not directly on the Linux host?

@animir
Copy link
Author

animir commented Apr 16, 2016

Thanks, @cpuguy83 and @thaJeztah
You both were right.
I didn't configure VirtualBox VM as well, hence docker didn't see any files and linked them as folders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants