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

Unable to mount files inside a container #241

Closed
lhridley opened this issue Apr 9, 2017 · 14 comments
Closed

Unable to mount files inside a container #241

lhridley opened this issue Apr 9, 2017 · 14 comments

Comments

@lhridley
Copy link

lhridley commented Apr 9, 2017

Before filing a new issue, be sure to check the FAQ for answers to many common questions about Dinghy.

I just installed Dinghy and attempted to start the docker containers for an existing project using the existing docker-compose.yml file for the project. In that .yml file I am mounting a configuration file over the existing configuration file in my nginx container.

When attempting to launch the docker stack using Dinghy I get an error:

ERROR: for nginx Cannot start service nginx: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting \\\"/Volumes/MyDigitalSSD/src/project/docker/nginx/project.conf\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/aufs/mnt/b1f83ff3d82fb1d429d9a8a3495bd294c4af88d95d276e22e5fcb52bd3434894\\\" at \\\"/mnt/sda1/var/lib/docker/aufs/mnt/b1f83ff3d82fb1d429d9a8a3495bd294c4af88d95d276e22e5fcb52bd3434894/etc/nginx/conf.d/default.conf\\\" 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

Does Dinghy not support mounting files inside containers? Are you limited to only mounting directories?

@codekitchen
Copy link
Owner

You can mount files inside containers same as with other Docker setups. That error seems to be saying that either project.conf on the host or default.conf in the container is a directory, rather than a file?

@lhridley
Copy link
Author

lhridley commented Apr 10, 2017

yes, I saw that, which is what prompted my question. Neither of those is correct. Both project.conf and default.conf are files, not directories, so what I'm trying to do is mount a file over a file.

@codekitchen
Copy link
Owner

Oh I see that the full path on the host is "/Volumes/MyDigitalSSD/src/project/docker/nginx/project.conf". By default Dinghy only shares your home directory with the VM, same as docker-machine. Have you modified your setup to share that volume with the VM? If not, I bet Docker is trying to auto-create that path inside the VM as a directory.

@lhridley
Copy link
Author

Yes, I modified my setup to share that volume, to no avail. The same error message occurred.

I did some additional troubleshooting over the weekend. It appeared that the local directories containing project files were not being made available inside the containers, despite having modified my setup to share that volume with the VM.

I also tried a couple of other projects that I have and those were failing as well.

I have since uninstalled Dinghy, reinstalled Docker for Mac and reimplemented Docker Sync since I could not successfully launch any of the projects that I currently have on my Macbook Pro using Dinghy.

@codekitchen
Copy link
Owner

Yeah in that case my first guess would be that the share path isn't getting switched over to that other host path as it should be. If you feel like digging into it at some point, you can dinghy ssh into the VM and poke around -- maybe run mount to verify the NFS mount is that /Volumes path as expected, and you should be able to ls /Volumes/MyDigitalSSD/src/project/docker/nginx/project.conf as if it was a local file if the NFS mount is working proper. I'm wondering if it's still mounting your home dir as the NFS share.

@r3m0t
Copy link

r3m0t commented Aug 31, 2017

I had the same issue, running docker-compose rm -v nginx && docker-compose up nginx fixed it. Which is weird as my nginx is pulled from Docker Hub rather than built locally.

@BaranOrnarli
Copy link

BaranOrnarli commented Sep 12, 2017

For those wondering about this bug, even at this point in time... There's a situation where if you use Docker Windows (with docker-compose) and use certain credentials to "Share Drive" such as C:\ or D:\ etc., you may have to unshare, share the drive again, re-enter credentials, otherwise it gives you an error related like:

"ERROR: for ... Cannot start service yourservice: oci runtime error: container_linux.go:262: starting container process caused "process_linux.go:339: container" caused "rootfs_linux.go:57: mounting \

"\" 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"

@RobertPepkaSEL
Copy link

To build on @BaranOrnarli 's answer, the specific situation I encountered was my domain requiring that I change my account password.

I went to docker settings -> Shared Drives . There I Reset my credentials, applied, unchecked my shared drives, applied, rechecked, apply, re-entered my credentials somewhere along the line, and eventually restarted my PC. Some of these steps may not be necessary, but this was the area that fixed it for me. :)

@zemelax
Copy link

zemelax commented Oct 13, 2017

And how to be the one who uses DockerToolbox?They dont have a options Share Drive" such as C:\ or D:\

@Xtrazyx
Copy link

Xtrazyx commented Jan 24, 2018

So you have to do this sharing procedure each time you reboot the machine ? It is insane !

@codekitchen
Copy link
Owner

I'm a bit confused about the discussion from BaranOrnarli's comment onwards. It does not sound related to the original issue report. I have zero experience running Docker Windows on MacOS, and it's not something that Dinghy supports at this time. If somebody could describe in detail how their environment is set up with Dinghy to run Docker Windows and what exactly the error repo steps are, that could be very useful in tracking down the problem.

@jessewebb
Copy link

jessewebb commented Mar 22, 2018

I also stumbled upon this GitHub issue and Baran's answer above helped me solve my problem too!

To respond to @codekitchen 's comments:
I Googled for: docker-compose "Are you trying to mount a directory onto a file"
https://www.google.ca/search?q=docker-compose+"Are+you+trying+to+mount+a+directory+onto+a+file"

The 1st hit was a (previously) unhelpful Stack Overflow Q&A and this page was the 2nd hit. For anybody using Docker for Windows, Baran's answer helped them, even if their problem had nothing to do with dinghy. I am not using dinghy myself either, just Docker for Windows.

I added a variation of Baran's solution to the StackOverflow Q&A that was the 1st Google hit so that hopefully the next Docker for Windows user won't need to come here for a solution to their problem.
My StackOverflow answer: https://stackoverflow.com/a/49439974/346561

@esdee-git
Copy link

@r3m0t 's tip worked for me; had the "not a directory" with rabbitmq's config files volume
docker-compose rm -v rabbitmq && docker-compose up rabbitmq FTW

@codekitchen
Copy link
Owner

While I'm glad this answer has helped people, it has nothing to do with Dinghy or this filed issue and this really isn't the right place to have posted it. Please take the discussion to that StackOverflow answer instead, I'll delete any further discussion in here.

Repository owner deleted a comment from maksym-vasyshchev-ss Apr 6, 2018
Repository owner locked as off-topic and limited conversation to collaborators Apr 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants