Skip to main content
added 343 characters in body
Source Link
Dan Cornilescu
  • 6.8k
  • 2
  • 19
  • 44

Note: answer based only on docs, I didn't play with docker much.

If you choose scripting you could pick a higher layer than just ps, based on either:

Usage: events [options] [SERVICE...]

Options:
    --json      Output events as a stream of json objects

Stream container events for every container in the project.

Description

Get real time events from the server

You'd be looking for the die event of the container(from Extended description):

Use docker events to get real-time events from the server. These events differ per Docker object type.

Object types

CONTAINERS

  • die

The event appears to be generated regardless of the restart policy (from Docker Events Explained):

enter image description here

But you're right, there's a ton of monitoring tools out there, I also suspect some already do what you're seeking.

Just aimlessly wandering through those links I got to Implementing Docker event monitoring from scratch:

What else? I can create alerts on them. The next time any of my containers decide to puke and die, I can get an SMS message about their doomed state.

Note: answer based only on docs, I didn't play with docker much.

If you choose scripting you could pick a higher layer than just ps, based on either:

Usage: events [options] [SERVICE...]

Options:
    --json      Output events as a stream of json objects

Stream container events for every container in the project.

Description

Get real time events from the server

You'd be looking for the die event of the container(from Extended description):

Use docker events to get real-time events from the server. These events differ per Docker object type.

Object types

CONTAINERS

  • die

The event appears to be generated regardless of the restart policy (from Docker Events Explained):

enter image description here

But you're right, there's a ton of monitoring tools out there, I also suspect some already do what you're seeking.

Note: answer based only on docs, I didn't play with docker much.

If you choose scripting you could pick a higher layer than just ps, based on either:

Usage: events [options] [SERVICE...]

Options:
    --json      Output events as a stream of json objects

Stream container events for every container in the project.

Description

Get real time events from the server

You'd be looking for the die event of the container(from Extended description):

Use docker events to get real-time events from the server. These events differ per Docker object type.

Object types

CONTAINERS

  • die

The event appears to be generated regardless of the restart policy (from Docker Events Explained):

enter image description here

But you're right, there's a ton of monitoring tools out there, I also suspect some already do what you're seeking.

Just aimlessly wandering through those links I got to Implementing Docker event monitoring from scratch:

What else? I can create alerts on them. The next time any of my containers decide to puke and die, I can get an SMS message about their doomed state.

Source Link
Dan Cornilescu
  • 6.8k
  • 2
  • 19
  • 44

Note: answer based only on docs, I didn't play with docker much.

If you choose scripting you could pick a higher layer than just ps, based on either:

Usage: events [options] [SERVICE...]

Options:
    --json      Output events as a stream of json objects

Stream container events for every container in the project.

Description

Get real time events from the server

You'd be looking for the die event of the container(from Extended description):

Use docker events to get real-time events from the server. These events differ per Docker object type.

Object types

CONTAINERS

  • die

The event appears to be generated regardless of the restart policy (from Docker Events Explained):

enter image description here

But you're right, there's a ton of monitoring tools out there, I also suspect some already do what you're seeking.