{# docker/service.html — one swarm service (#5302): its state and what it runs, where its replicas are and what they use, Swarm's record of its recent tasks, its CPU and memory over time, and the logs of every task it has run. A failure's "Logs →" lands on #logs with ?task= picked. #} {% extends "base.html" %} {% from "_macros.html" import crumbs, status_badge, status_dot, stat_tile %} {% from "docker/_usage.html" import cpu, mem, cores %} {% block title %}{{ name }} — Docker — Steward{% endblock %} {% block breadcrumb %}{{ crumbs([("Docker", "/plugins/docker/"), (name, "")]) }}{% endblock %} {% block content %} {% if service is none %}
{{ "No longer running" if task_choices else "Service not found" }} {% if task_choices %} No swarm service named {{ name }} is reported now; it may have been removed. The logs Steward still keeps from its tasks are below. {% else %} No swarm service named {{ name }} is reported, and Steward holds no logs or events for one. It may have been removed. Back to Docker {% endif %}
{% else %} {# ── Header: is it well, then what it is ─────────────────────────────────── #} {% set tone = 'ok' if row.state == 'healthy' else ('warn' if row.state == 'degraded' else 'crit') %} {% if row.last_error %} {% set e = row.last_error %}

Last failed task

{{ e.error or e.message or e.state }}{% if e.exit_code %} (exit {{ e.exit_code }}){% endif %} {%- if e.node %} · on {{ e.node }}{% endif %}{% if e.age_s is not none %} · {{ e.age_s|duration }} ago{% endif %} {%- if e.task_id %} · its logs →{% endif %}

{% endif %}
{{ stat_tile("CPU", cores(row.cpu_cores) if row.cpu_cores is not none else "—", hint="across running replicas") }} {{ stat_tile("Memory", row.mem_bytes|bytes if row.mem_bytes is not none else "—", hint="across running replicas") }} {{ stat_tile("Up", (row.started_at|ago|striptags|replace(" ago", "")) if row.started_at else "—", hint="since its newest replica started") }} {{ stat_tile("Failed (24h)", row.failures_24h or 0, state="warn" if row.failures_24h else none, hint="tasks Swarm replaced", href="#tasks" if row.failures_24h else none) }}
Image
{{ (svc.image if svc and svc.image else row.image) or "—" }}
Mode
{{ row.mode }}{% if row.mode != 'global' %}, {{ row.desired }} replica{{ "s" if row.desired != 1 }}{% endif %}
{% if svc %}
Reported
{{ svc.updated_at|ago }} by the manager's agent
{% endif %}
{# ── Replicas: where it runs and what each uses ──────────────────────────── #}

Replicas {{ replicas|length }}

{% if replicas %} {% for r in replicas %} {% if r.ghost %} {% else %} {% endif %} {% endfor %}
NodeContainerStatus CPUMemoryUp
{{ r.host }} {{ r.count }} running on a node with no Steward agent: no figures for {{ "it" if r.count == 1 else "them" }}{% if r.host_id %}{{ r.host }}{% else %}{{ r.host }}{% endif %} {{ r.name }} {{ status_dot('up' if r.status == 'running' else 'down') }} {{ r.status }} {%- if r.health == 'unhealthy' %} {{ status_badge('crit', 'Unhealthy') }}{% elif r.health == 'starting' %} {{ status_badge('pending', 'Starting') }}{% endif %} {% if r.usage %}{{ cpu(r.usage) }}{% else %}—{% endif %} {% if r.usage %}{{ mem(r.usage) }}{% else %}—{% endif %} {{ r.uptime or "—" }}
{% else %}

No replica is running.

{% endif %}
{# ── Resource history, summed across replicas ────────────────────────────── #}

Resource history

{% include "_time_range.html" %}

Loading…

{# ── Swarm's record of its recent tasks ──────────────────────────────────── #}

Tasks Swarm's most recent, newest first

{% if tasks %} {% for t in tasks %} {% endfor %}
SlotTaskNodeState ExitWhyWhen
{{ t.slot or "—" }} {% if t.task_id %}{{ t.task_id[:10] }}{% else %}—{% endif %} {{ t.node }} {%- if t.failed %}{{ status_badge('crit', t.state|capitalize) }} {%- elif t.current %}{{ status_badge('ok', 'Running') }} {%- else %}{{ t.state }}{% endif %} {%- if t.desired and t.desired != t.state and not t.current %} → {{ t.desired }}{% endif -%} {% if t.exit_code %}{{ t.exit_code }}{% else %}—{% endif %} {{ t.why or "" }} {% if t.at %}{{ t.at|ago }}{% else %}—{% endif %}
{% else %}

No task record yet: the manager's agent reports them from version 1.8.0.

{% endif %}
{% endif %} {# ── Logs across every task, newest first ───────────────────────────────── Shown for a removed service too, while its lines are still kept. #} {% if service is not none or task_choices %}

Logs every task, newest first

{% if task_choices|length > 1 %} {% elif focus_task %}{% endif %}

Loading…

{% endif %} {% endblock %}