Docker run attempts to mount a file I didn’t ask for

docker

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?

Best Answer

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