0

Is it possible to configure the dns for the concourse build container.

I know there is a build_args: argument with the docker-image-resource but I am unable get it to replicate the following docker build parameter--dns=IP_ADDRESS...

Has anyone done something similar in their pipeline.yml?

blane
  • 9
  • 6
  • Does the DNS of your build need to be different from the DNS of your daemon and other containers on the host? – BMitch Feb 20 '17 at 23:05

1 Answers1

2

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).

Matt
  • 68,711
  • 7
  • 155
  • 158