Issue: Docker Images automatically getting deleted.


Cause:

Docker starts deleting images when the disk utilization exceeds 75%.


Major issue which occurs when the docker image gets deleted

Example: ODP Base image automatically getting deleted

In ODP ,when the Data service deployment fails we check the DM pod logs (please find below the attachment of the DM pod logs) .It is mentioned that error has occurred at the data step 1/11 :From odp:base image, i.e when its trying fetch the odp base image and the base image does not exists.






Work-Around Solution:

1. Make sure that exited containers are deleted.

When a docker container exits, the container is not deleted automatically. You can see all of the containers with ‘docker ps -a’ command. To clean up the exited containers, the command to use is as follows.

docker rm -v $(docker ps -a -q -f status=exited)

This will remove the exited containers. The -v flag is there to remove any containers that will no longer be needed. If there are no such containers you will see an error message like below.

docker: “rm” requires a minimum of 1 argument. See ‘docker rm –help’.

It just means that there’s nothing to delete and you are good to go.

 

2. Remove unwanted ‘dangling’ images.  

Docker keeps all of the images that you have used in the disk, even if those are not actively running. This is done so that it has the necessary images in the local ‘cache’. The command to remove these unwanted images is as follows.

docker rmi $(docker images -f "dangling=true" -q)

Again, you might get an error message that the rmi commands need an argument if you don’t have any such images.