feat: show Docker container names in Development servers
Merged
DA
4h ago+50+50+01234567890123456789-10-10-01234567890123456789
Package
Development servers (dev-servers), 1.0.2 → 1.1.0.
Ports published by Docker or OrbStack containers used to show the helper process that forwards them (for example OrbStack Helper · PID 7575), so every container looked the same. The popup now shows the container's name instead, such as geocity-frontend-1 · container. Other ports are unchanged.
Changes
servers.shrunsdocker ps --format '{{.Names}}\t{{.Ports}}'and maps each published host port, including port ranges such as8000-8002->…, to its container name, reading only TCP entries. A port shows the container name only when the process listening on it is Docker's helper (OrbStack…orcom.docker…); any other port keepsprocess · PID.- When
dockerisn't installed or the daemon isn't running, the command's error is ignored and the list looks as before. - The package README mentions the container names.
- Stop on a container row runs
docker stop <container>. Before, it sentSIGTERMto the helper process, which forwards every container's ports, so it stopped all of them. Other rows keep the 1.0.2 behavior.
Access
scripts/servers.sh:lsofas before, plusdocker ps(read-only, local Docker socket) whendockeris on the PATH. No network requests.scripts/stop.sh: with a third argument (the container name, quoted with@shinservers.sh), runsdocker stopon that container. Without it, unchanged.requiresstays["jq"].dockeris optional, so it isn't listed: StableBar's review names every listed tool it can't find, which would make Docker look mandatory.- No permissions or hosts.
Testing
STABLEBAR=/Applications/StableBar.app/Contents/MacOS/StableBar ./scripts/check-package.sh packages/dev-serverswith StableBar 0.20.0 ends withValid configuration: 1 widgets in 5 files.I didn't run it against a build of StableBarmain.- Ran
servers.shwith OrbStack running and the other ports in use:localhost:3000 geocity-frontend-1 · container localhost:3773 T3 Code (Nightly) · PID 12222 localhost:5432 ams-pgsql-1 · container localhost:9095 geocity-web-1 · container localhost:9099 geocity-web-1 · container - Checked the port-range parsing on sample
docker psoutput (8000-8002->8000-8002/tcpmaps 8000, 8001 and 8002). - Used the changed script on my own bar; screenshot of the popup below.
- Not checked:
shellcheck(not installed locally, left to CI), and Docker Desktop. I only have OrbStack, but both use the samedockerCLI output.
Summary by cubic
Shows the name of the Docker or OrbStack container that publishes a port (for example geocity-frontend-1 · container) instead of the helper process, so containers no longer all look the same.
- Stop runs
docker stopon that container instead of sendingSIGTERMto the helper process, which forwards every container's ports. It passes the container's ID and the daemon endpoint the list was read from, so a stale row can't stop a newer container that took the name, and a changed Docker context can't redirect the stop to another daemon. - Maps published host ports to container names using
docker pswhendockeris on the PATH, including port ranges like8000-8002->…. - Only queries a local daemon: it checks the Docker context first and asks only when the endpoint is a unix socket, so a remote context is never contacted.
- Only applies the container label when the helper process on that port is
OrbStackorcom.docker, so a local listener is never renamed. - When
dockerisn't installed or the daemon isn't running, errors are ignored and the list looks as before; Stop on those rows refuses to kill the helper. - Other ports keep showing
process · PID. - Version bumped to 1.1.0 and the README mentions the container names and the stop behavior.
Summary by CodeRabbit
- New Features
- Published ports from Docker and OrbStack can display the associated container name when Docker is available, running, and using a local Mac context. Remote Docker contexts are not queried; other listeners continue to display their process name and PID.
- Selecting Stop for a container stops that container without stopping the forwarding helper. Selecting Stop for a Docker or OrbStack listener does not stop the shared service or its containers.
- Documentation
- Clarified when container names are displayed and what happens when stopping containers or Docker-related listeners.