It's unlikely you will be able to set this via Concourse due to lack of support in Docker.
The --dns=IP_ADDRESS
option you reference is a docker run
argument.
The docker build
command doesn't allow you to change the DNS settings for the build containers that run under it.
This recent github issue links to a bunch of the related issues:
Workarounds
Set Container DNS for a RUN step
You can modify the local /etc/resolv.conf
during a build step in a Dockerfile:
FROM busybox:latest
RUN set -uex; \
echo "nameserver 8.8.8.8" > /etc/resolv.conf; \
cat /etc/resolv.conf; \
ping -c 4 google.com
RUN cat /etc/resolv.conf
It will be back to normal for the next run step though.
Set Daemon DNS
You can configure a Docker daemon with a custom DNS server for all containers that don't override the dns.
dockerd --dns 8.8.8.8
It's possible to run a specific "Build" instance of Docker with custom DNS if you needed the builds to be different to what you run your containers run with.
Set Host DNS
Edit /etc/resolv.conf
on the host to point at your DNS. This obviously effects everything running on the host.
It's possible to run a local caching server that can be configured to forward your required requests to a local DNS server and forward anything else to your normal DNS servers (similar to what Docker does locally for a container DNS).