Control-D-Inc / ctrld

A highly configurable, multi-protocol DNS forwarding proxy
MIT License
424 stars 21 forks source link

Docker image #50

Closed agneevX closed 1 year ago

agneevX commented 1 year ago

Hello,

An official multi-arch Docker image would make deployments very easy.

yegors commented 1 year ago

But the deployment is already easy: a single installer command.

Where are you deploying this to?

agneevX commented 1 year ago

I'm deploying to both local and remote servers that run Docker.

yegors commented 1 year ago

Quick and dirty, could probably be improved to use alpine, but this works.

# Use a base image with curl installed
FROM ubuntu:latest

# Set the working directory
WORKDIR /app

# Download the DNS proxy server
RUN apt-get update && \
    apt-get install -y curl ca-certificates iproute2  && \
    rm -rf /var/lib/apt/lists/*

# Download the DNS proxy server
RUN curl -L -o ctrld https://assets.controld.com/ctrld/linux/amd64/ctrld && \
    chmod +x ctrld

# Expose the required ports
EXPOSE 53/tcp 53/udp

# Start the DNS proxy server with the supplied argument
CMD ["sh", "-c", "./ctrld run --listen=0.0.0.0:53 --primary_upstream=$arg"]

Then

docker build -t docker-ctrld .

Then

docker run -d --name=ctrld -p 53:53/tcp -p 53:53/udp -e arg=https://freedns.controld.com/p2 docker-ctrld
yegors commented 1 year ago

Docker image is now available: https://hub.docker.com/r/controldns/ctrld