From cache perspective, what is the difference between docker restart and docker-compose restart?

178 views Asked by At

Apologies in advance if these questions are very basic. But I failed to find answers that are on-point:

In terms of clearing the container cache (not policies and not SIGTERM):

1- What is the difference between running the following commands:

  • docker restart
  • docker-compose restart
  • docker-compose down followed by docker-compose up

2- When restarting a container, in what order the following command get executed:

  • docker stop
  • docker kill
  • docker rm
  • docker start
  • docker run

UPDATE: Explaining the Problem

According to this issue of the docker registry, the Garbage Collection command doesn't clear the cache related to the deleted image blobs. This causes an error when pushing any deleted image again to the registry. One solution is to restart the container. Basically, it does the job of clearing the container cache including the Garbage Collection blobs cache. I tested it and it works.

But I am just confused because I used to run docker-compose down followed by docker-compose up and the cache didn't get cleared. Only when restarting the container, either by docker restart, docker-compose restart or restarting the server itself, that the push process (of previously deleted images) work again.

(Note that pushing new images always works).

That is why I would appreciate it if someone explain to me the difference between the above commands from a container cache point of view.

Thank you

0

There are 0 answers