DockerSdk
the .NET SDK for Docker
Classes | Enumerations
DockerSdk.Containers.Events Namespace Reference

Classes

class  ContainerCreatedEvent
 Represents a notification of the creation of a new container. It will be at the ContainerStatus.Created state. More...
 
class  ContainerDeletedEvent
 Represents a notification that the container has been deleted. More...
 
class  ContainerEvent
 Represents an event emitted by the Docker daemon about a container. More...
 
class  ContainerExitedEvent
 Indicates that the container's main process has exited. This is a transition to the ContainerStatus.Exited state (such as from the ContainerStatus.Running of ContainerStatus.Paused state). If the process shut down due to a "stop" or "restart" command (as opposed to a "kill" command), Docker will also emit ContainerStopCompletedEvent. More...
 
class  ContainerPausedEvent
 Indicates that the container has transitioned from the ContainerStatus.Running state to the ContainerStatus.Paused state. The container's process is simply not given any CPU time until it is unpaused. More...
 
class  ContainerRestartCompletedEvent
 
class  ContainerSignalledEvent
 Indicates that Docker has sent a signal to the container. Typically this is used to either ask the container's process to shut down or to force the container to end the process. It does not represent a state change, but may cause one. More...
 
class  ContainerStartedEvent
 Represents a notice that the container has begun its main process, transitioning to the ContainerStatus.Running state. The container might previously been in the ContainerStatus.Exited or ContainerStatus.Created state. Restart commands also issue this event in the second half of their action. More...
 
class  ContainerStopCompletedEvent
 
class  ContainerUnpausedEvent
 

Enumerations

enum class  ContainerEventType {
  Created , Exited , Paused , Deleted ,
  RestartCompleted , Signalled , Started , StopCompleted ,
  Unpaused
}
 The types of event that containers can raise in the Docker event system. More...
 

Enumeration Type Documentation

◆ ContainerEventType

The types of event that containers can raise in the Docker event system.

Enumerator
Created 

The creation of a new container. It will be at the ContainerStatus.Created state.

Events of this type are represented by the ContainerCreatedEvent class. Docker documentation calls this event type "create".

Exited 

The container's main process has exited. This is a transition to the ContainerStatus.Exited state (such as from the ContainerStatus.Running of ContainerStatus.Paused state). If the process shut down due to a "stop" or "restart" command (as opposed to a "kill" command), Docker will also emit StopCompleted.

Events of this type are represented by the ContainerCreatedEvent class. Docker documentation calls this event type "die".

Paused 

The container has transitioned from the ContainerStatus.Running state to the ContainerStatus.Paused state. The container's process is simply not given any CPU time until it is unpaused.

Events of this type are represented by the ContainerPausedEvent class. Docker documentation calls this event type "pause".

Deleted 

The container has been deleted.

Events of this type are represented by the ContainerDeletedEvent class. Docker documentation calls this event type "destroy".

RestartCompleted 

Docker has finished restarting the container, as though by a docker container restart CLI command, and has transitioned from the ContainerStatus.Restarting state to the ContainerStatus.Running state. The container might previously been running, stopped, paused, or even in the ContainerStatus.Created state.

If you're only interested in state changes, and not which specific command caused them, it may be best to simply ignore this event type, since it's always preceded by Started anyway.

Events of this type are represented by the ContainerRestartCompletedEvent class. Docker documentation calls this event type "restart".

Signalled 

Docker has sent a signal to the container. Typically this is used to either ask the container's process to shut down or to force the container to end the process. It does not represent a state change, but may cause one.

Events of this type are represented by the ContainerSignalledEvent class. Docker documentation calls this event type "kill", regardless which signal is sent–including signals that would not normally cause a process to end.

Started 

The container has begun its main process, transitioning to the ContainerStatus.Running state. The container might previously been in the ContainerStatus.Exited or ContainerStatus.Created state. Restart commands also issue this event in the second half of their action.

Events of this type are represented by the ContainerStartedEvent class. Docker documentation calls this event type "start".

StopCompleted 

Docker has finished performing a "stop" operation, either on its own or in the first half of a restart operation.

If you're only interested in state changes, and not which specific command caused them, it may be best to simply ignore this event type, since it's always preceded by Exited anyway.

Docker "kill" commands do not emit this event; however, the presence of this command does not necessarily mean that the process shut down gracefully. In particular, if someone performs a "stop" operation on a paused container, it appears that the container will be only briefly unpaused before it's forcibly shut down. (Sequence of events: signal 15, unpause, signal 9, exit stop.)

Events of this type are represented by the ContainerStopCompletedEvent class. Docker documentation calls this event type "stop".

Unpaused 

The container has transitioned out of the ContainerStatus.Paused state.

Note that an unpause event might be part of a sequence that ultimately stops or deletes the container.

Events of this type are represented by the ContainerUnpausedEvent class. Docker documentation calls this event type "unpause".