Docker Community Forums

Share and learn in the Docker community.

Cannot build docker image due to "mount volume over existing file"

build

(Dfont) #1

I am running into an issue where my builds are failing because of the following error when declaring a volume:

Step 12/13 : VOLUME /var/lib/postgresql/data
cannot mount volume over existing file, file exists /var/lib/docker/aufs/mnt/1ec75bdc83c23cd984672166348ef00f3536105cca4e2642c63efcccfbec5bc9/var/lib/postgresql/data

I built the image earlier, ran it locally (without mounting the volume), then edited the Dockerfile, and attempted to build it again. I’ve removed all of my stopped containers, as well as deleted all of my dangling volumes. docker volume ls shows no volumes, yet I am still getting this error. Additionally, each time I run it the directory name after mnt changes in the error message.

Does anyone know what is wrong with these builds? Even if there were any data on those volumes, I would want the volume to be deleted. Thanks.