Skip to content

Specific user cases

Karim Shakirov edited this page Mar 25, 2020 · 2 revisions

Accessing localhost from container

Sometimes for revers proxy you need access services on localhost or you don't want to attach Caddy's container to multiple containers' networks. In this case you can run Caddy connected to host network and access this containers over localhost:somePort.

Usage:

  • run this docker-compose file:
version: '3'
services:
  caddy:
     image: caddy/caddy
     network_mode: host
     volumes:
       - ./caddy_data:/data
       - ./file/Caddyfile:/etc/caddy/Caddyfile
  • don't forget to allow 80 and 443 in firewall

It's might be not safe and throws away most of the network security that Docker provides

Clone this wiki locally