Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 1.01 KB

File metadata and controls

43 lines (29 loc) · 1.01 KB

Signal handling

Exercise 1

Build and start image using commands below:

export CMD=plain; docker build --file Dockerfile-shell-go --build-arg CMD -t signal-handling:shell-${CMD} .
docker run -d signal-handling:shell-${CMD} 

stop image using command:

docker stop <CONTAINER_ID>
  • Explain why docker stop doesn't stop process immediately and
  • fix Dockerfile to receive termination signals.

Hints:

  • use docker inspect <CONTAINER_ID> to explore container runtime settings
  • remember previous exercise

Exercise 2

Verify that signals being sent to process end in successful closing of process.

export CMD=signal; docker build --file Dockerfile-shell-go --build-arg CMD -t signal-handling:shell-${CMD} .
docker run -d signal-handling:shell-${CMD} 

Exercise 3

Operations version of Ex2

Verify that signals being sent to process end in successful closing of process.

docker build --file Dockerfile-trap -t signal-handling:trap .
docker run -d signal-handling:trap