docker / roadmap

Welcome to the Public Roadmap for All Things Docker! We welcome your ideas.
https://github.com/docker/roadmap/projects/1
Creative Commons Zero v1.0 Universal
1.45k stars 246 forks source link

Feature request: MacOS level notifications on container's health change #224

Open petr-ujezdsky opened 3 years ago

petr-ujezdsky commented 3 years ago

FEATURE REQUEST

We are developing web application using docker-compose with multiple containers. Each container has properly implemented the healthcheck property, so the health status should be always correct. The web-server takes several minutes to start up. The problem is there is no easy way to determine when the app is up and ready and you can actually start using it. It also may fail to start.

You can periodically check for containers state, but that is not ideal in my opinion:

watch -n5 docker-compose ps

So we have implemented some small utility that parses the output of docker events, specifically

 docker events \
    --filter 'event=start' \
    --filter 'event=die' \
    --filter 'event=health_status' \
    --format '{{.Time}}|{{.Actor.Attributes.name}}|{{.Status}}'

and it creates macOS notification with health status update for specified containers (using https://github.com/julienXX/terminal-notifier).

It would be very nice to have this implemented directly by docker-for-mac. The easiest way I can think of would be to add some predefined label to given containers to start tracking their health-status via notifications. This should provide full flexibility and opt-in opt-out functionality.

Expected behavior

Notifications on health status change per container

Actual behavior

No notifications

stephen-turner commented 3 years ago

Thanks for the suggestion, moving to docker/roadmap.

hasnat commented 1 month ago

it'd be cool to allow notifications with "restart" option for unhealthy notifications, my garbage code containers do need a whipping every now and then.