Skip to content

Docker Compose Example

Nicolas Duchon edited this page Dec 8, 2024 · 3 revisions

Create docker network, which is going to be used by proxy and proxied servers.

docker network create proxy-net

Example of docker-compose.yaml

services:
  proxy:
    container_name: proxy
    image: nginxproxy/nginx-proxy
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
    environment:
      - TRUST_DOWNSTREAM_PROXY=false  # true if there is another proxy in front of this one
    networks: 
      - proxy-net  # proxy and all proxied servers have to be on the same network

  proxied_server1:
    image: your_image:latest
    environment:
      - VIRTUAL_HOST=your.domain.com
      - VIRTUAL_PORT=3000 # the same port as in expose
    expose:
      - 3000  # port your app uses to communicate
    depends_on:
      - proxy
    networks:
      - proxy-net

networks:
  proxy-net:
    name: proxy-net
    external: true
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy