How to delete image cache memory?

i deleted the files in the folder /var/lib/docker/overlay2/
now I can’t build the image and get error

Step 1/6 : FROM  node:12.13.1 AS build
 ---> 7be6a8478f5f
Step 2/6 : WORKDIR /lims-ui
lstat /var/lib/docker/overlay2/6da88b2abf0a1786b00cf1566cec75f02908e0e4259399d5b48908f39e6eb1cf: no such file or directory

I tried deleting the image and repull it, but that doesn’t help.

docker pull node:12.13.1
12.13.1: Pulling from library/node
844c33c7e6ea: Already exists
ada5d61ae65d: Already exists
f8427fdf4292: Already exists
f025bafc4ab8: Already exists
7a9577c07934: Already exists
9b4289f800f5: Already exists
55e3fcab47b9: Already exists
c7a94e331913: Already exists
bb9efc0c132a: Already exists
Digest: sha256:88ee7d2a5e18d359b4b5750ecb50a9b238ab467397c306aeb9955f4f11be44ce
Status: Downloaded newer image for node:12.13.1
docker inspect 7be6a8478f5f
`Error response from daemon: stat /var/lib/docker/overlay2/6da88b2abf0a1786b00cf1566cec75f02908e0e4259399d5b48908f39e6eb1cf: no such file or directory`

docker remembers the image cache anyway

how can i fix this?
I think, i need to reset docker state so it doesn’t remember anything about the cache

There is no reason to butcher your docker configuration like that :smiley:
The overlay2 folder contains data for images and container - non of the sub folders of /var/lib/docker should be deleted unless you know exactly what you do and why it needs to be done.

Docker has build-in commands that are ment to be used for house keeping tasks:
docker image prune: delete all dangling images (as in without an assigned tag)
docker image prune -a: delete all images not used by any container
docker system prune: delete stopped containers, unused networks and dangling image + dangling build cache
docker system prune -a: delete stopped containers, unused networks, images not used by any container + all build cache

You might want to try if docker system prune -a is able to fix the inconsistent state. If not I would suggest to finish off what you started: stop the docker engine, remove /var/lib/docker, start the docker engine and start with a new slate → everything (volumes, networks, images and containers) will be gone!

1 Like

docker system prune -a It did not help
remove /var/lib/docker That helped

thanks a lot