I've recently pulled a nginx image:
docker pull nginx
I can run it successfully and go to http://server_name and see the "Welcome to Nginx" page:
docker run -d -p 80:80 nginx
But then when I try to check logs:
docker exec 6c79549e3eb4f6e5fc06f049b67814ac4560ce2cdd7cc6ae84b44b5ae09a9a05 cat /var/log/nginx/access.log
It just hangs and outputs nothing. Same with error log. Now if I create a test.txt file in that same folder and use docker exec to (view) cat the file, I executes without hanging or any issues.
Even if I try to run it in interactive mode, it just hangs:
docker run -i -t -p 80:80 nginx
Once again the terminal hangs on the next line doing nothing, but it seems to work because I can access the nginx welcome page.
Really confused what is going on, I've tried to search for this problem, but have not found any solution so far. Without being able to view the logs, it is going to be pretty hard to debug :) Also shouldn't the access logs be moved to stdout in the nginx container since by convention docker containers log to stdout?
/var/log/nginx/access.log
exist in the container? Try to get into the container and run commands interactively withdocker run -i -t -p 80:80 nginx /bin/bash
– Maroldals -al
instead of justls
and post the output. – Marolda