docker-elk: Bind mounts do not work with remote Docker deamon
I am getting this when I do docker-compose up
logger (master) ✗ dc up
Creating logger_elasticsearch_1 ...
Creating logger_elasticsearch_1 ... error
ERROR: for logger_elasticsearch_1 Cannot start service elasticsearch: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting \\\"/Users/foo/bar/logger/elasticsearch/config/elasticsearch.yml\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/0b7be06fbdsadsadds5f8e14dddf0d6c632370b4299300efe5\\\" at \\\"/var/lib/docker/aufs/mnt/0b7bdsadsadasdd2235c5f8e14dddf0d6c632370b4299300efe5/usr/share/elasticsearch/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
ERROR: for elasticsearch Cannot start service elasticsearch: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting \\\"/Users/darshanchoudhary/zinnov/logger/elasticsearch/config/elasticsearch.yml\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/0b7be06fbd6ef6b20adc69235bd2235c5f8e14dddf0d6c632370b4299300efe5\\\" at \\\"/var/lib/docker/aufs/mnt/0b7be06fbd6ef6b20adc69235bd2235c5f8e14dddf0d6c632370b4299300efe5/usr/share/elasticsearch/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
ERROR: Encountered errors while bringing up the project.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 22 (2 by maintainers)
Commits related to this issue
- Emphasize that the repo is to be cloned on the Docker host Closes #134 — committed to deviantony/docker-elk by antoineco 5 years ago
- Emphasize that the repo is to be cloned on the Docker host Closes #134 — committed to bleed2002/docker-elk by antoineco 5 years ago
- Emphasize that the repo is to be cloned on the Docker host Closes #134 — committed to DanBrown47/docker-elk by antoineco 5 years ago
- Emphasize that the repo is to be cloned on the Docker host Closes #134 — committed to jcruzcruz/docker-elk by antoineco 5 years ago
Of course, but then please let me remind you the importance of being fair to the people trying to help you, and avoid the thumb down reactions. Mentioning the
docker-machinesetup from the beginning could have saved me some confusion and give you the right pointers right away.Docker is running on an Operating System (Ubuntu) which is itself running inside a VM powered by your host (Mac).
The files present on your Mac are not visible from your Linux virtual machine, they reside on a file system which is not accessible by the Docker daemon. Therefore mounting
/Userswill fail because this path does not exist from the standpoint of the Ubuntu box (take a look inside your VM).Virtualbox has a feature called “Shared Folders” which lets you sync folders between your host machine (Mac) and guest machine (Ubuntu) (ref: 4.3. Shared folders). I remember that
docker-machinehas a flag that allows you to configure such a folder during the VM creation process, it’s called--virtualbox-share-folder(source: Docker Machine VirtualBox drive).Docker for Mac does not have this problem because it mounts the
/Usermountpoint from your Mac inside the VM using more complex mechanisms. There’s a great blog post about it here: https://blog.docker.com/2017/05/user-guided-caching-in-docker-for-mac/ (scroll to “Bind mounts on Docker for Mac”).[Windows] So I had the same issue. This is caused sometimes because of some weird docker error. I did the following to make it working again:
Under the settings section of the docker windows software, you may have to unshare, share the drive again, re-enter credentials.
Thank you for the pointers, I have since removed the thumbs down. I thought it was a thoughtless comment on your part (about the path being a macOS path)
Also, I agree that I did not provide complete information about my setup. One detail I missed is that I am using docker machine not to create a machine on my PC, but on AWS. I used the
amazonec2adapter to spawn up an Ubuntu instance there anddocker-composeed.The directory would not exist there (as you pointed out), but that is the reason we are mounting it in the docker-compose.yml file, isn’t it? The reason I opened the issue is, I cloned the repo, spun up an amazon ec2 ubuntu instance and did
dc upand it did not work. It failed with the error I pasted 🔝