Skip to content

Instantly share code, notes, and snippets.

@souhaiebtar souhaiebtar/readme.md
Last active Sep 6, 2017

Embed
What would you like to do?
make portainer accessible using domain(in our case portainer.test.dev)
reverseProxyPortainer
├── portainer
│   └── docker-compose.yml
└── reverseProxy
    ├── docker-compose.yml
    └── vhost.d
        └── portainer.test.dev
  1. docker network create --driver=bridge reverseproxy_default
  2. cd reverseProxyPortainer/reverseProxy
  3. docker-compose up
  4. cd ../portainer
  5. docker-compose up
  6. open /etc/hosts and add 127.0.0.1 portainer.test.dev
  7. open your browser and go to http://portainer.test.dev and portainer UI will show

reverseProxyPortainer/reverseProxy/docker-compose.yml

version: "2"
services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: reverseproxy
    restart: always
    ports:
      - "80:80"
    volumes:
      - "/var/run/docker.sock:/tmp/docker.sock:ro"
      - "./vhost.d:/etc/nginx/vhost.d:ro"
networks:
  default:
    external:
      name: reverseproxy_default

reverseProxyPortainer/reverseProxy/vhost.d/portainer.test.dev

proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

reverseProxyPortainer/portainer/docker-compose.yml

version: '2'
services:
  portainer:
    image: portainer/portainer
    container_name: Portainer
    restart: always
    expose:
      - 9000
    ports:
      - 9000:9000
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    environment:
      - VIRTUAL_HOST=portainer.test.dev
      - VIRTUAL_NETWORK=reverseproxy_default

networks:
  default:
    external:
      name: reverseproxy_default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.