Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

219
Vistas
Getting docker stats programmatically

I am using docker-py and trying to get docker stats. But I am unable to get any API for returning stats for particular container. Is there a REST API or any other way to programmatically get the stats ?

>>> cli = docker.Client(base_url="tcp://xxxxx:2375", version='1.21')
>>> cli.containers() >> gives the right o/p
>>> cli.containers.get()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'function' object has no attribute 'get'

>>> docker.version
'1.10.6'
about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You may be looking for Container.stats.

about 4 years ago · Santiago Trujillo Denunciar

0

  1. Get stats for a particular container name example: "monitoring-tinydb". Note: change this container name with your desired container id or name.

    import docker
    client = docker.from_env()
    container = client.containers.get("monitoring-tinydb")
    status = container.stats(decode=None, stream = False)
    print(status)
    
    
  2. Get stats for all containers running in the docker host

    import docker
    client = docker.DockerClient(base_url='unix:///var/run/docker.sock')
    for containers in client.containers.list():
        print(containers.stats(decode=None, stream = False))
    
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda