socat-dns-docker/README.md

1.7 KiB

socat-dns-docker

Build Status git github matrix BSD-3-Clause-No-Military-License

use socat to forward to the dns server of a bridged docker network.

this is a pretty simple docker image. you can simply clone this repo and build the container:

docker build -t socat-dns:latest

# run the container
network="bridge"
container_ip="172.17.0.10"

docker run -d --rm -it \
  --network="$network" \
  --ip "$container_ip"
  --name socatdns -p 127.0.0.1:53:5353 \
  socat-dns:latest

then you can send a query to container from the host:

$ dig socatdns @172.17.0.10 -p 5353 +short
172.17.0.10

or use the port forwarded to loclahost:

$ dig socatdns @127.0.0.1 +short
177.17.0.10

examples

use the pre-built container with a docker-compose.yml file:

version: '3'

services:
  socatdns:
    image: git.sudo.is/ben/socat-dns:latest
    container_name: socatdns
    restart: always
    ports:
      - 127.0.0.1:5353:53