Created
December 13, 2017 15:33
-
-
Save jeckel/059377dafa492514d6c19e65b5f2158d to your computer and use it in GitHub Desktop.
Portainer with NGinx
This file contains hidden or 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
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 |
This file contains hidden or 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
FROM nginx:alpine | |
MAINTAINER Julien MERCIER <[email protected]> | |
# Remove existing configuration | |
RUN rm -v /etc/nginx/conf.d/* | |
# Insert our portainer conf | |
COPY portainer.conf /etc/nginx/conf.d/portainer.conf |
This file contains hidden or 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
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