From f28132bd2386d6ca2ff6b59c828f5962a67bef7d Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Fri, 25 Mar 2016 17:51:56 +0100 Subject: [PATCH] Add catch all server with default error page --- Dockerfile | 3 +++ index.html | 10 ++++++++++ nginx.conf | 9 +++++++++ nginx_proxy.py | 2 ++ 4 files changed, 24 insertions(+) create mode 100644 index.html diff --git a/Dockerfile b/Dockerfile index 0a1fe57..da12735 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,9 @@ MAINTAINER Joachim Lusiardi RUN apt-get update; \ apt-get install -y nginx; +RUN mkdir /default +ADD index.html /default/index.html +RUN chmod -R 777 /default ADD nginx.conf /etc/nginx.conf ADD start.sh /start.sh RUN chmod +x /start.sh diff --git a/index.html b/index.html new file mode 100644 index 0000000..de731b5 --- /dev/null +++ b/index.html @@ -0,0 +1,10 @@ + + + Ooops - Not found + + + +

Ooops - Not found

+

Sorry, the requested page was not found!

+ + diff --git a/nginx.conf b/nginx.conf index 18a021f..d37fc75 100644 --- a/nginx.conf +++ b/nginx.conf @@ -11,6 +11,15 @@ http { log_format http_combined '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" HTTP'; include /tmp/nginx/*; + + server { + listen *:80 default_server; + root /default; + index index.html; + location / { + try_files $uri /index.html; + } + } } daemon on; diff --git a/nginx_proxy.py b/nginx_proxy.py index 8f29887..eb0bff5 100755 --- a/nginx_proxy.py +++ b/nginx_proxy.py @@ -171,6 +171,8 @@ if __name__ == '__main__': line_str = line.decode("utf-8") event = json.loads(line_str) + if not 'id' in event: + continue container_id = event['id'] try: inspect_data = client.inspect_container(container_id)