Bind mount issue on Docker for Windows
@brianjill
please help i got this error too. i am running docker in windows 7
> container_linux.go:262: starting container process caused "process_linux.go:339: container init caused "rootfs_linux.go:57: mounting \"/c/appl/jill/docker-elk/docker elk/elasticsearch/config/elasticsearch.yml\" to rootfs \"/mnt/sda1/var/lib/docker/overlay2/da9207cefa5d09a1bc0214938296659e0c6f9f8b7bee13fc39e4922459ad4f40/merged\" at \"/mnt/sda1/var/lib/docker/overlay2/da9207cefa5d09a1bc0214938296659e0c6f9f8b7bee13fc39e4922459ad4f40/merged/usr/share/elasticsearch/config/elasticsearch.yml\" caused \"not a directory\"""
did this inside the docker terminal
$ docker-compose up Starting dockerelk_elasticsearch_1 ... Starting dockerelk_elasticsearch_1 ... error
ERROR: for dockerelk_elasticsearch_1 Cannot start service elasticsearch: oci ru ntime error: container_linux.go:262: starting container process caused "process_ linux.go:339: container init caused "rootfs_linux.go:57: mounting \"/c/appl/j ill/docker-elk/docker-elk/elasticsearch/config/elasticsearch.yml\" to rootfs \"/mnt/sda1/var/lib/docker/overlay2/da9207cefa5d09a1bc0214938296659e0c6f9f8b7be e13fc39e4922459ad4f40/merged\" at \"/mnt/sda1/var/lib/docker/overlay2/da9207 cefa5d09a1bc0214938296659e0c6f9f8b7bee13fc39e4922459ad4f40/merged/usr/share/elas ticsearch/config/elasticsearch.yml\" caused \"not a directory\""" : Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
On Windows you have to select which drives can be mounted inside the Docker VM: https://blogs.msdn.microsoft.com/stevelasker/2016/06/14/configuring-docker-for-windows-volumes/
Also I'm not familiar with Windows, but it seems like /c/appl/jill should be c:/appl/jill.
ok will check it out and come back thanks :)
where should i mount it to /mnt/sda1/var/lib/docker/overlay2/? sorry i am new to docker
The path is taken care of for you, you can leave it to the default value in the docker-compose.yaml file. You can probably ignore my second comment because I'm quite sure Docker is installed with sane default parameters.
The first comment is very important though, can you check your "Shared Drive" setting in Docker for Windows and report whether C: is shared or not?
Also I've seen people suggesting to use the following syntax in the Compose file:
- ///c/appl/jill/docker-elk/docker-elk/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
I can not try myself unfortunately, but maybe it's a good hint for you.
source: https://forums.docker.com/t/volume-mounts-in-windows-does-not-work/10693/138
its fixed now i mount my c: drive to /c/ thanks
@brianjill @antoineco
Thanks. I didn't have any clue on what you said. After a little bit of search, I have created a step by step here: https://gerardnico.com/wiki/docker/installation_windows_7#shared_drive
Thanks @gerardnico, that's so cool! Very useful :+1:
Hi, I noticed that resolving relative paths is not working correctly in docker for windows. I have the following docker-compose.yml:
version: "3.3"
services:
nginx:
volumes:
- type: bind
source: ./nginx.conf
target: /tmp/nginx.conf
read_only: true
The nginx.conf is located in the same directory as the docker-compose.yml.
When I run docker-compose up, I receive the same error as @antoineco.
When I substitute the relative path with an absolute path of the form C:/.../nginx.conf in my docker-compose.yml, everything works fine.
This is really annoying because I do not want to have absolute paths in my compose files.
Docker version:
Client:
Version: 17.11.0-ce
API version: 1.34
Go version: go1.8.4
Git commit: 1caf76c
Built: Mon Nov 20 18:30:11 2017
OS/Arch: windows/amd64
Server:
Version: 17.11.0-ce
API version: 1.34 (minimum version 1.12)
Go version: go1.8.5
Git commit: 1caf76c
Built: Mon Nov 20 18:39:28 2017
OS/Arch: linux/amd64
Experimental: true
@Mobe91 What's the path that you get in your error ? For instance, @antoineco gets this path:
/c/appl/jill/docker-elk/docker elk/elasticsearch/config/elasticsearch.yml\
This path must be available inside your docker host.
@gerardnico It is strange, I cannot reproduce this anymore... It now seems to work with the relative part although I reverted the .yml back to its original state. If it happens again I will get back to you.
On a Windows 10 laptop with Docker Toolbox the solution for me was to move the website code into C:\users\sites. stackoverflow link