As title says I was renaming one of my docker images I built using Dockerfile and docker-compose.yml using the command docker tag old-image-name new-image-name
, after that I used docker images
to check on my current images and I had BOTH the old and the new one.
I removed the old one using docker image rm IMAGE_ID
and since then I've been getting the following error failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount511639725/Dockerfile: no such file or directory
when I try to start the container.
I've tried everything, other containers start without problem and I've successfully ran this container in the past. This are the only changes I've made, nothing changed on my Dockerfile or docker-compose.yml.
I've tried removing the images related to this stack to build again many times. also tried rebuilding the image with Dockerfile alone (not trough docker-compose.yml).
CodePudding user response:
This error usually means it cannot find your docker file. It usually happens when its named incorrectly, make sure your docker file is named exactly as "Dockerfile"
CodePudding user response:
$ docker images | grep hello-world
hello-world $ docker tag hello-world hello-worldxxx
$ docker images | grep hello-world
hello-world latest feb5d9fea6a5 14 months ago 13.3kB
hello-worldxxx latest feb5d9fea6a5 14 months ago 13.3kB latest feb5d9fea6a5 14 months ago 13.3kB
$ docker tag hello-world hello-worldxxx
$ docker images | grep hello-world
hello-world latest feb5d9fea6a5 14 months ago 13.3kB
hello-worldxxx latest feb5d9fea6a5 14 months ago 13.3kB
docker tag old-image-name new-image-name
like create a alias name.
you can find new-image-name id is same as old image id,
so if docker image rm IMAGE_ID
, you kill old and new, they are same image id.
$ docker image rm -f feb5d9fea6a5
and check again
$ docker images | grep hello-world
nothing. Old and new are delete.