DNSCrypt / dnscrypt-server-docker

A Docker image for a non-censoring, non-logging, DNSSEC-capable, DNSCrypt-enabled DNS resolver
https://dnscrypt.info
ISC License
660 stars 134 forks source link

Is it possible to run this image behind a VPN? #114

Closed TheGITofTeo997 closed 1 year ago

TheGITofTeo997 commented 1 year ago

Hello, I am trying to achieve what i wrote in title. Basically I would like to have this image running in docker, but I would like the dns resolution (to roots I guess) to happen through a commercial VPN, also running in another container.

What I tried is to tell this container to use network_mode: service:vpn (in docker compose) and then to publish 443:443 from the VPN container, but unfortunately I can't contact my server from here because it times out.

Am I missing something or this is not even possible? (Maybe I have to change the IP under -E with the one from the VPN?)

Thanks for the help

TheGITofTeo997 commented 1 year ago

I will leave here my docker-compose:

name: media-stack
services:
  vpn:
    container_name: vpn
    image: qmcgaw/gluetun
    cap_add:
      - NET_ADMIN
    environment:
      - VPN_SERVICE_PROVIDER=expressvpn
      - OPENVPN_USER=[USER]
      - OPENVPN_PASSWORD=[PASS]
      - SERVER_COUNTRIES=France
    ports:
    - 443:443/tcp
    - 443:443/udp
    networks:
      - dnscrypt-network
    restart: "unless-stopped"

  dnscrypt-server:
    container_name: dnscrypt-server
    restart: unless-stopped
    network_mode: service:vpn
    ulimits:
      nofile:
        soft: 90000
        hard: 90000
    volumes:
    - /etc/dnscrypt-server/keys:/opt/encrypted-dns/etc/keys
    depends_on:
    - vpn
    command: init -N res.[myres].net -E [MY SERVER IP]:443
    image: jedisct1/dnscrypt-server
networks:
  dnscrypt-network:
    external: true