In docker inspect, what do "StartedAt" and "FinishedAt" mean?

Viewed 330

This is the result of running docker inspect on a running container:

$ docker inspect some_container | jq .[0].State
{
  "Status": "running",
  "Running": true,
  "Paused": false,
  "Restarting": false,
  "OOMKilled": false,
  "Dead": false,
  "Pid": 16086,
  "ExitCode": 0,
  "Error": "",
  "StartedAt": "2021-09-16T02:36:12.036585245Z",
  "FinishedAt": "2021-09-16T04:36:10.87103895+02:00"
}

Nobody was logged into that system at the times listed in the StartedAt and FinishedAt entries, and it doesn't seem like the container was restarted after a crash:

$ docker inspect lxonlinedlservice_rabbitmq_1 | grep RestartCount
        "RestartCount": 0,

What do the StartedAt and FinishedAt entries mean?

2 Answers

From github

  • startedAt - Time at which previous execution of the container started
  • finishedAt - Time at which the container last terminated

You mentioned crash. Maybe container started after a crash at 2021-09-16T02:36:12.036585245Z and at 2021-09-16T04:36:10.87103895+02:00 there was another crash?

Or, might it me that docker host where the container runs was rebooted?

Suggest also to check that your clock is synced using ntp. Check this docker best practice.

To get the exact uptime for a container: docker inspect -f '{{ .State.StartedAt }}' CONTAINER_ID StartedAt: when you started your image or container FinishedAt: when you stopped your image or container (from this answer https://stackoverflow.com/a/28203469/500902)

Related