Fail2Ban on CaddyV2 Docker?

1. Caddy version (caddy version):

> command docker exec -it caddy caddy version
v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=

2. How I run Caddy:

On Raspberry Pi 3 with docker.

a. System environment:

Raspberry pi 3, docker,

b. Command:

docker-compose -f caddy/docker-compose.yml up -d

c. Service/unit/compose file:

version: "3.8"
services:
  caddy:
    image: caddy
    container_name: caddy
    hostname: caddy
    env_file: ../.env
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    environment:
      - DOMAIN
      - DOMAIN_LOCAL
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - ./data:/data
      - ./config:/config

networks:
  default:
    external:
      name: $NETWORK

d. My complete Caddyfile or JSON config:

{
    # acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
}

portainer.{$DOMAIN} portainer.{$DOMAIN_LOCAL} {
    reverse_proxy {$IP_PORTAINER}:9000
}

home.{$DOMAIN} home.{$DOMAIN_LOCAL} {
    reverse_proxy {$IP_HOMEASSISTANT}:8123
}

3. The problem I’m having:

How do I integrate fail2ban into CaddyV2 docker image?

4. Error messages and/or full log output:

None

5. What I already tried:

Read this:

Answer seems unclear. I’m not sure if it’s do-able or not?

Can someone explain if it’s possible to run fail2ban either inside or alongside the caddyV2 docker image? Maybe another image should be created that has this integrated as it’s a very popular security tool?

6. Links to relevant resources:

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.