I have a simple Dockerfile like this
FROM ubuntu:latest
ADD run.sh /run.sh
CMD /run.sh
In run.sh, I have this (also deadly simple)
#!/bin/bash
nohup awk 'BEGIN { while (c++<50) print "y" }' &
sleep 10
When I run the script in docker from bash (that is, run bash command in interactive mode and there run the script), it works correctly - it goes into "nohup mode" and the output is, correctly, in nohup.out.
However, if I run the docker container with the /run.sh
as the default command, the output is still in STDOUT.
What am I doing wrong? Why is it working in docker, in bash, but only when it's run from interactive mode?