I made most simple C application which just printing a message:
#include <stdio.h>
#include <unistd.h>
int main(){
int i = 0;
while(1) {
sleep(1);
printf("sleeping ... %d\n", i++);
}
}
Then, made a simplest possible Dockerfile for it:
FROM fedora
USER root
WORKDIR /root
ADD sleep-play .
CMD ["/root/sleep-play"]
Then, run that container as simple as it could:
sudo docker build -t sleeping .
sudo docker run --name sleeping -d sleeping
Finally I'm expecting to see my stdout output, but nothing happens:
sudo docker logs -f sleeping
## nothing shown!
From here:
... By default, docker logs shows the command’s STDOUT and STDERR.
What I'm doing wrong?