{# docker/widget.html — the dashboard Docker widget (#5252), in the widget-shape order: a verdict line; the services and containers in trouble; what failed in the last 24h, by name; then everything healthy, one line each, packed into as many columns as the widget is wide. Resource use is the Busiest Containers widget's, so it isn't repeated here. #} {% from "_macros.html" import status_dot %} {% if total_count == 0 %}
No containers reported yet.
{% else %} {% set wrong = bad_services|length + bad_containers|length %}
{%- if services_total %}{{ services_healthy }}/{{ services_total }} services healthy · {% endif -%} {{ running_count }} other container{{ 's' if running_count != 1 }} running · {% if failures %}{{ failures|length }} failed in 24h{% else %}nothing failed in 24h{% endif -%}
{% if wrong %}
Needs a look
{% for s in bad_services %}
{{ status_dot('degraded' if s.state == 'degraded' else 'down') }} {{ s.name }} {%- if s.crash_looping %}crash-looping: {{ s.failures_1h }} failed in the last hour{% else %}{{ s.running }} of {{ s.desired }} running{% endif %} {%- if s.trouble_since %}, since {{ s.trouble_since|ago }}{% endif %} {%- if s.last_error and (s.last_error.error or s.last_error.message) %} · {{ s.last_error.error or s.last_error.message }}{% endif -%} {{ s.running }}/{{ s.desired }}
{% endfor %} {% for c in bad_containers %}
{{ status_dot('warn' if c.status == 'restarting' else 'down') }} {%- if session.user_id %}{{ c.name }}{% else %}{{ c.name }}{% endif %} {%- if c.health == 'unhealthy' %}unhealthy{% elif c.status == 'restarting' %}restarting{% else %}exited {{ c.exit_code }}{% if c.oom_killed %}, out of memory{% endif %}{% endif %} {%- set since = (bad_since or {}).get((c.host_id, c.name)) %}{% if since %} since {{ since|ago }}{% endif %} · {{ host_name.get(c.host_id, c.host_id) }}
{% endfor %} {% endif %} {% if failures %}
Failed in the last 24h
{% for f in failures[:5] %}
{{ status_dot('failed') }} {{ f.name }} {% if f.count > 1 %}{{ f.count }} times, last {% endif %}{{ f.at|ago }}{% if f.detail %} · {{ f.detail }}{% endif %} · {{ f.host }}
{% endfor %} {% if failures|length > 5 %}
+{{ failures|length - 5 }} more · the full list
{% endif %} {% endif %} {% if healthy %}
Healthy
{% for h in healthy %}
{% if h.kind == 'service' %}{% set s = h.s %} {{ status_dot('up') }} {{ s.name }} · {{ s.replicas|map(attribute='host')|unique|join(', ') }} {{ s.running }}/{{ s.desired }} {% else %}{% set c = h.c %} {{ status_dot('up' if h.kind == 'container' else 'unknown') }} {%- if session.user_id %}{{ c.name }}{% else %}{{ c.name }}{% endif %} · {{ host_name.get(c.host_id, c.host_id) }} {% if h.kind == 'stopped' %}stopped{% endif %} {% endif %}
{% endfor %}
{% if healthy_more %}
+{{ healthy_more }} more healthy · all of Docker
{% endif %} {% endif %} {% endif %}