Say I have a docker compose file like this:
version: '2'
services:
  randomDNStest:
    dns: 
      - ###.###.###.###
    network_mode: "host"
    build: .
and a Dockerfile like this:
FROM gitlab/gitlab-runner
RUN ["gitlab-runner", "register", "--non-interactive", "--url", "THE INTERNAL GIT LAB INSTANCE", "--registration-token", "MY TOKEN", "--executor", "docker", "--tag-list", "docker", "--description", "DESCRIPTION", "--docker-image",  "docker:19.03.1", "--docker-dns", "###.###.###.###",  "--docker-privileged", "--docker-tlsverify", "--docker-volumes", "/certs/client"]
How can I specify the DNS server for the Dockerfile to use at build time (in the run command)?
Things similar to what I want but not right:
- Using docker run --dns.- Doesn't work with docker-compose.
 
- Modifying the DNS service on the host to listen on a non-localhost address that is reachable from within the container as described here and implemented here.
- Probably works, but requires set-up on the host.
 
- Using the dnssection in docker-compose as shown above.- This works at run-time, not build-time.
 
- Using curl's --dns-serversparameter with the parameters described here- Curl command format: curl -X POST -F token=QytSH_88wASA_LA6G2mf --dns-servers ###.###.###.### https://INTERNAL_GIT_LAB//api/v4/runners
- Curl's --dns-serverscommand must be compiled in as described in the curl docs and in Nathan Leclaire's blog, but I couldn't get the dependencies right, and this only avoids using the problem for my specific use case.
 
- Curl command format: 
- Using the network_mode: "host"driver as shown above and described here- This doesn't work.
 
 
    