Created
September 26, 2014 14:02
-
-
Save stuart-warren/6eb9ab53a3bebc895c40 to your computer and use it in GitHub Desktop.
Docker log to stdout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sometimes you want your container to log to stdout, but the process can only write to a file. | |
e.g. nginx | |
Simply create a symlink from the logfile you are writing to, to /proc/self/fd/1 or write directly to it. | |
Example: | |
user www-data; | |
worker_processes 4; | |
pid /run/nginx.pid; | |
events { | |
worker_connections 2048; | |
multi_accept on; | |
use epoll; | |
} | |
http { | |
server_tokens off; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
keepalive_timeout 15; | |
types_hash_max_size 2048; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
access_log /proc/self/fd/1; | |
error_log /proc/self/fd/1 info; | |
gzip on; | |
gzip_disable "msie6"; | |
include /etc/nginx/conf.d/*.conf; | |
include /etc/nginx/sites-enabled/*; | |
open_file_cache max=100; | |
} | |
daemon off; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment