# Docker containers in your Mac’s menu bar, through Portainer

See how every container on your Docker host is doing without opening Portainer: which need you, which have health checks, how many were running through the day, and each container’s CPU, memory and health checks on its own page. Docker’s own socket isn’t a web API, so the pages read it through Portainer CE.

## What you’ll see

- **Portainer:**
  - **Containers:** every container as a dot, under Needs attention, Healthy, No health check and Stopped. A dot is red for an unhealthy container, one that exited with an error code, or one on your **keep-running** list that isn’t running. It’s orange while one restarts, and for 10 minutes after one that’s been around a while starts again, whether it crashed or you restarted it: that’s how a container that keeps crashing shows. A container that was stopped cleanly is grey and never counts as a problem, unless it’s on your keep-running list. Each dot opens that container’s page.
  - **Running:** how many containers were running, over the last day.
  - **Docker:** how many containers, in how many compose projects; the images, the space they take and how much of it belongs only to images no container uses; the Docker version, CPUs and memory; the volumes and the networks. **Remove unused images** in its corner asks first, then frees at least that much; the images can be pulled again.
- **Container:** one page for every container, titled with its name:
  - how it stands now, with Start, Stop, Restart and **Pull and recreate** (the newest image, the same settings) in the card’s corner;
  - its CPU and memory over the last hour, and its state over the last day;
  - **Open:** a link to each port it publishes, on your environment’s Public IP, or to its `homepage.href` label;
  - **Logs:** its last 10 log lines, errors marked;
  - its image, compose project, restart policy, restarts and when it last started, its last four health checks, and its mounts.

Stop never shows for a container on your **keep-running** list. Without the list, every container has Stop.

### Status

- Watches every container.
- Red for an unhealthy container, one that exited with an error, or one on your keep-running list that isn’t running.
- Orange while one restarts, for 10 minutes after one starts again, or while its health check is starting.
- A container stopped cleanly never counts as a problem, unless it’s on your keep-running list.
- Red once Portainer stops answering.
- Notifies you when it turns orange or red.

## How it connects

The pages read Portainer CE’s API with your access token, sent as `X-API-Key`. Requests for containers go through Portainer to Docker on your host.

| Request | Pages | When | What it supplies |
| --- | --- | --- | --- |
| `GET /api/endpoints/1/docker/containers/json?all=1` | Portainer | Once a minute | Every container, its state and Docker’s own status words. The page shows up to 60, and says so when there are more. |
| `GET /api/docker/1/dashboard` | Portainer | Every 15 minutes | How many containers, images, volumes, networks and compose projects. |
| `GET /api/endpoints/1` | Portainer | Every 15 minutes | The Docker version, CPUs and memory. |
| `GET /api/endpoints/1/docker/system/df` | Portainer | Every 15 minutes | Which images no container uses, and their size. |
| `GET /api/system/version` | Portainer | Every hour | Whether a newer Portainer is out. Portainer asks GitHub each time, so it’s hourly. |
| `POST /api/endpoints/1/docker/images/prune?filters=%7B%22dangling%22%3A%7B%22false%22%3Atrue%7D%7D` | Portainer | When you press Remove unused images and confirm | Removes every image no container uses. |
| `GET /api/endpoints/{param.env}/docker/containers/{param.id}/json` | Container | Once a minute while open | The container’s state, health checks, restarts, ports and mounts. |
| `GET /api/endpoints/{param.env}` | Container | Once a minute while open | The environment’s Public IP, for the port links. |
| `GET /api/endpoints/{param.env}/docker/containers/{param.id}/stats?stream=false` | Container | Once a minute while open | Its CPU and memory. |
| `GET /api/endpoints/{param.env}/docker/containers/{param.id}/logs?stdout=1&stderr=1&tail=20&timestamps=1` | Container | Once a minute while open | Its latest log lines. |
| `POST /api/endpoints/{param.env}/docker/containers/{param.id}/start` | Container | When you press Start and confirm | Starts the container. |
| `POST /api/endpoints/{param.env}/docker/containers/{param.id}/stop?t=10` | Container | When you press Stop and confirm | Stops it. |
| `POST /api/endpoints/{param.env}/docker/containers/{param.id}/restart?t=10` | Container | When you press Restart and confirm | Restarts it. |
| `POST /api/docker/{param.env}/containers/{answer.c.Id}/recreate` | Container | When you press Pull and recreate and confirm | Pulls the newest image and recreates the container with the same settings. |

That’s about 75 requests an hour with the Portainer page open, plus 240 an hour while a container’s page is open. Legato also keeps each container’s state every 5 minutes in [History](https://legatobar.com/docs/history.md), for its page’s day.

[Sources and buttons](https://legatobar.com/docs/sources.md) explains each part of a page.

## Set it up

1. **Make an access token.** In Portainer, open **My account → Access tokens → Add access token**, as an administrator. Portainer CE has no read-only role, so a token can also stop and remove containers: keep it to Legato.
2. **Save it in Legato.** In Settings → Secrets, save the token under `portainer`, bound to your Portainer’s address. You can also link a [1Password reference](https://legatobar.com/docs/1password.md).
3. **List what must keep running (optional).** In Settings → Lists, add a list called `keep-running` with the containers you never want to stop by accident, such as your reverse proxy and DNS. Their Stop button never shows.
4. **Add the pages.** Paste the prompt into your agent, or download the two pages and run `/Applications/Legato.app/Contents/Helpers/legato set portainer-container portainer-container.json`, then `legato set portainer portainer.json`. Keep the ID `portainer-container`: every dot and row opens it.
5. **Give your environment a Public IP** (optional). In Portainer, open **Environments**, choose yours and fill in **Public IP** with your host’s address. Each container’s page then links to the ports it publishes.
6. **Point them at Portainer.** Change `https://portainer.example.com` to your Portainer’s address on every source, and the environment id `1` on the Portainer page to yours: it’s the number in Portainer’s address when you open your environment (`#!/3/docker/dashboard` is 3).

The cards fill within a minute. A mistyped token is the usual reason they don’t: the page then notes that Portainer refused it.

### Prompt for your agent

```prompt
Add 2 Legato pages for Portainer, starting from https://legatobar.com/examples/portainer.json, https://legatobar.com/examples/portainer-container.json. Use the page IDs portainer, portainer-container if they’re free: the pages link to each other by those IDs, so with any other ID, change the matching legato://page/ links.

Add the pages as they are, keeping their page IDs. Change https://portainer.example.com on every source of both pages to my Portainer’s address, and the environment id 1 on the Portainer page to mine. I’ll save my access token as portainer in Settings → Secrets, and add a keep-running list in Settings → Lists, myself. Don’t press Start, Stop, Restart, Pull and recreate or Remove unused images to test them.

Use the local Legato MCP tools or /Applications/Legato.app/Contents/Helpers/legato.
Use list_pages first and choose an unused page ID. Do not overwrite an existing page. If I explicitly ask to update one, read its full body with get_page, preserve unrelated cards and settings, and use if_match with that version. On version_mismatch, read again before merging.
Ask me only for non-secret setup details that are missing. Never ask me to paste a password, token or API key into chat, page JSON or command arguments. Tell me to save it in Settings → Secrets for the service host, or link it from 1Password there.
Use the downloadable page, not the illustration’s sample data. Never invent readings. Fix any invalid_page paths and verify that the page loads. Do not press buttons that change the service or real devices to test it.
```

### Download the pages

- [Download Portainer (portainer.json)](https://legatobar.com/examples/portainer.json)
- [Download Container (portainer-container.json)](https://legatobar.com/examples/portainer-container.json)

## Questions

### Why does a stopped container sometimes not count as a problem?

Docker tells a clean stop (exit code 0) from a crash. A container that stopped cleanly, such as a one-off job, is grey. One that exited with an error, or one on your keep-running list, is red.

### Why can’t I see when an image has an update?

Portainer CE doesn’t check: that’s in Portainer’s Business Edition, so the pages can’t show it.

### Does Spotlight ask before it removes images?

No. Spotlight presses a button you choose by name without asking, as it does for every button, so **Remove unused images** goes straight through from there. The images can be pulled again. Start, Stop, Restart and Pull and recreate aren’t in Spotlight, since it couldn’t say which container they’d act on.

### Does it work with several Docker hosts?

The Portainer page shows one environment. For another, add a copy of the page with its own ID, that environment’s id in its paths, and no `collect`: only one page can keep the containers’ History. Each dot still opens the one container page, which then shows no day for that host’s containers.

Legato is independent and isn’t affiliated with or endorsed by Portainer or Docker.

## Verification

The pages were filled from Portainer CE 2.45.3 on 9 Nov 2026, managing a Docker 29.8 host with 27 containers. A container that’s unhealthy, crashed or restarting, and the buttons, are checked by tests with made-up answers. Illustrations use made-up containers and numbers. See the [service index](https://legatobar.com/services/) for other examples.
