DEV Community

Cover image for Real time notification on Docker container status
Yuen Ying Kit
Yuen Ying Kit

Posted on

Real time notification on Docker container status

Originally posted on Boatswain Blog.

In the recent release of the Boatswain web portal (version 0.1.6), we have implemented a simple real time notification mechanism on the Docker container status. We hope this is helpful to engineer responding quickly to any unexpected issue happen on their container.

Setup the real time notification

Now, Boatswain user could setup the real time notification on the Notification Settings page which in under the Settings menu on the top right hand corner.

Notification Settings

Enable the real time notification

Sometimes, not all the containers running on the Docker server are our concerns. So we allow user to enable the notification feature selectively by using regular expression. Any containers with name matched with the regular expressions would have notification enabled.

Here are the two rules when setting up the regular expression:

  1. Include the / before and after.
  2. Only accepts the i flag.

Configure the regular expression to enable notification

Check out which container have notification enabled

Below the regular expression form, there is a list showing the containers which have notification enabled. Any detected containers in the recent 24 hours will be listed.

List of notification enabled containers

Please note that the above list is just for reference and any newly added container would also have notification enabled as long as its name matched any regular expression.

Receive the notification email

Whenever the container status is changed, the email address associated with the corresponding Boatswain account would receive an notification email. Here is an example:

Hi ykyuen,

We have detected a status change of the following container:
Host:            camus
Container ID:    1d2ce3c96b372fc61622c0c0133efda6de24cd2fad2e8faab810b8539d3ce4a1
Container name:  nginx-test
Container image: nginx:latest
Command:         nginx -g 'daemon off;'
Status change:   running -> exited
Exit code:       0
Is OOM killed:   No

- Boatswain Team
 ____              _                     _
|  _ \            | |                   (_)
| |_) | ___   __ _| |_ _____      ____ _ _ _ __
|  _ < / _ \ / _` | __/ __\ \ /\ / / _` | | '_ \
| |_) | (_) | (_| | |_\__ \\ V  V / (_| | | | | |
|____/ \___/ \__,_|\__|___/ \_/\_/ \__,_|_|_| |_|

What's next?

We notice that Boatswain consumes certain amount of server resources and user might hang back especially when his/her application is running on a small instance. So we are working on the Boatswain configuration and let user decide the frequency of the metrics and log collections.

Lastly, happy coding ๐Ÿ‘จโ€๐Ÿ’ป and wishing all the best to all of you ๐ŸŽŠ ๐Ÿ€ ๐ŸŽ‰.

Top comments (0)