0

I have a long running process in a docker container that is setup like this:

Dockerfile

...
ENTRYPOINT ["./invoke.sh"]

invoke.sh

#!/bin/bash
./long-running-command

If long-running-command is running properly, it will send output to STDERR every few seconds. If it hangs, it will stop outputting to STDERR. How can I use a monitor or parent process to auto-detect when long-running-command has stopped writing data for a period of time (about 2 minutes) and auto-kill long-running-command?

Shaun
  • 13
  • 4

1 Answers1

0

From the documentation:

By default, docker logs or docker service logs shows the command’s output just as it would appear if you ran the command interactively in a terminal.

Use the docker logs command to check stderr.

To kill the command, you can stop the container. If that is not possible or desirable, there are methods to find the PID of the long running process.

berndbausch
  • 1,033
  • 8
  • 12