# Pi-Hole with ovpn and caddy (docker-compose)

**URL:** <https://discourse.pi-hole.net/t/pi-hole-with-ovpn-and-caddy-docker-compose/23889>\
**Category:** docker\
**Created:** [September 23, 2019, 1:26am UTC](https://discourse.pi-hole.net/t/pi-hole-with-ovpn-and-caddy-docker-compose/23889 "2019-09-23T01:26:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hyperliskdev](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/h/97f17d/32.png) [@hyperliskdev](https://discourse.pi-hole.net/u/hyperliskdev)\
**Post date:** [September 23, 2019, 1:26am UTC](https://discourse.pi-hole.net/t/pi-hole-with-ovpn-and-caddy-docker-compose/23889/1 "2019-09-23T01:26:01Z")

</div>

I have run into an issue with a docker-compose file. I want to run a docker container that uses caddy as a proxy and the openvpn is using pihole as dns ad blocking.

```yaml
services:

  caddy:
    image: "wemakeservices/caddy-docker:latest"
    ports:
      - "2015:2015"
      - "80:80"
      - "443:443"
    depends_on:
      - openvpn
      - pihole
    
  openvpn:
    image: kylemanna/openvpn:latest
    container_name: openvpn
    cap_add:
     - NET_ADMIN
    ports:
     - "1194:1194/udp"
    restart: always
    volumes:
     - ./openvpn-data/conf:/etc/openvpn

  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    environment:
      TZ: 'Canada/Eastern'
    volumes:
       - './etc-pihole/:/etc/pihole/'
       - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
    dns:
      - 127.0.0.1
      - 1.1.1.1
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
    network_mode: "host"

```

The error I am getting is that pi-hole isn't able to add a listening socket to port 53. I have killed all processes on port 53 and don't even have port 53 listed in the docker-compose file. What am I missing? Is it a misunderstanding?

---

<div class="post-metadata">

**Author:** ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)\
**Post date:** [September 23, 2019, 1:27am UTC](https://discourse.pi-hole.net/t/pi-hole-with-ovpn-and-caddy-docker-compose/23889/2 "2019-09-23T01:27:19Z")

</div>



---

<div class="post-metadata">

**Author:** ![diginc](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/diginc/32/96_2.png) [@diginc](https://discourse.pi-hole.net/u/diginc)\
**Post date:** [September 23, 2019, 3:12am UTC](https://discourse.pi-hole.net/t/pi-hole-with-ovpn-and-caddy-docker-compose/23889/3 "2019-09-23T03:12:29Z")

</div>

Is this on ubuntu or some other OS? The ubuntu port-53-conflict avoidance section of the readme was recently updated : [GitHub - pi-hole/docker-pi-hole: The official Pi-hole Docker image from pi-hole.net](https://github.com/pi-hole/docker-pi-hole#installing-on-ubuntu)

Having `network_mode: “host”` makes it so you don't have to list the ports, the container automatically tries to connect up to your host ip.

---

<div class="post-metadata">

**Author:** ![system](https://discourse.pi-hole.net/uploads/default/original/3X/7/c/7c8792f649eeb921c5d2b4c41564ffa873d9a2b8.png) [@system](https://discourse.pi-hole.net/u/system)\
**Post date:** [September 3, 2022, 9:35am UTC](https://discourse.pi-hole.net/t/pi-hole-with-ovpn-and-caddy-docker-compose/23889/4 "2022-09-03T09:35:22Z")

</div>


