Skip to content

Instantly share code, notes, and snippets.

@jeckel
Created December 13, 2017 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeckel/059377dafa492514d6c19e65b5f2158d to your computer and use it in GitHub Desktop.
Save jeckel/059377dafa492514d6c19e65b5f2158d to your computer and use it in GitHub Desktop.
Portainer with NGinx
version: '2'
# Configure a dedicated volume for storing Portainer's configuration
#
volumes:
portainer_data:
services:
# Configure Portainer service
#
portainer:
image: portainer/portainer
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
command: -H unix:///var/run/docker.sock
restart: always
networks:
- local
# Configure NGinx proxy service
#
nginx:
build: docker/
ports:
- "80:80"
depends_on:
- portainer
restart: always
networks:
- local
# Link network to the docker bridge driver
#
networks:
local:
driver: bridge
FROM nginx:alpine
MAINTAINER Julien MERCIER <devci@j3ck3l.me>
# Remove existing configuration
RUN rm -v /etc/nginx/conf.d/*
# Insert our portainer conf
COPY portainer.conf /etc/nginx/conf.d/portainer.conf
upstream portainer {
server portainer:9000;
}
server {
listen 80;
location / {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://portainer/;
}
location /api/websocket/ {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_pass http://portainer/api/websocket/;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment