5

When I try to run an image without any mounts, why is Docker still trying to mount something that I didn't ask for?

docker run --rm myapp bash

docker: Error response from daemon: cannot mount volume over existing file, file exists /var/lib/docker/aufs/mnt/9326735ac6d36724bcb8e49ac2f0dd8288ad92ce385fe24ebaffc19a3a9c5756/etc/myapp.yml.

I have a running container that mounts this file, but why is Docker trying to mount it when I want to run a one-off command?

4

If I remember right, we had the same issue because of dangling volumes, as @Mohammed Noureldin said.

I couldn't delete the image, but this code worked fine for me https://coderwall.com/p/hdsfpq/docker-remove-all-dangling-volumes

| improve this answer | |
  • 2
    This still doesn't explain why a volume would block a run of an image when neither the run command or the image involve any volumes. – Alex Grönholm Dec 27 '16 at 22:05
0

I faced the same error before, I forget what I did exactly to get that, but the solution which worked for me is clear all the containers which uses the image "myapp", and remove any dangling volumes.

Then remove the base image "myapp" and rebuild (or download) it, and then retry to run your container.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.