Motivation: To run a basic health check in a docker container, considering that a certain number of messages go through stdout over a certain time horizon
Immediate Goal:. Inside the shell launched with docker exec
, read the data that is passed to standard output (stdout) from the main process (PID 1)
I'm not even sure if what I want is possible. If so, the explanation of why not be highly appreciated would help to advance my knowledge.
Steps to play:
Run the container - container1
docker run -it --name container1 ubuntu bash -c -i "COUNT=0; while true; do echo Keep the dance floor beat going; ((COUNT++)); sleep 1; echo \"Count is: \${COUNT}\"; done;"
In a different terminal window, docker exec
to start another process in the same container docker exec -it container1 bash
Can I somehow tail
/ print
/ read
send messages via stdout using PID 1?
I understand that there is work around - for example, laying through tee
or otherwise writing to disk - but I was hoping for a magic bullet.
source share