Docker-py: Container uptime

Created on 14 Aug 2017  路  1Comment  路  Source: docker/docker-py

Python 2.7.12
docker==2.4.2
Docker version 17.05.0-ce, build 89658be

docker ps returns status like

Up 5 days

but container object contains status in docker inspect format (ex. "running").
Is there a possibility get the uptime of container?

kinquestion

Most helpful comment

You can compute it yourself using ctnr.attrs['State']['StartedAt'], or you can use the client.api.containers() method where it's listed directly.

>All comments

You can compute it yourself using ctnr.attrs['State']['StartedAt'], or you can use the client.api.containers() method where it's listed directly.

Was this page helpful?
0 / 5 - 0 ratings