Is there a way to find running time of containers when using `docker run — rm`

The Docker daemon does record container creation and deletion via events . Those logs have timestamps and canonical references to container names, so could be used for your purposes.

Unfortunately there isn’t (AFAIK) a good way to persist Docker events within docker itself (they can’t be logged to a file), however you could use something like

curl --no-buffer -XGET --unix-socket /var/run/docker.sock http://localhost/events

and redirect that somewhere to get a log of Docker events created on a host.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top