How to config the dns for a container

I try to config a dns for a container with --dns

but after connect another network for this container, the dns config has been reset.

So, Is it possible to reconfig the dns of the container?


create a container with --dns

# docker run -d -t --name t1 --dns="" busybox

get the resolv.conf

# docker exec 53 cat /etc/resolv.conf

create a network

# docker network create testNet1 --subnet

connect the network to the container

# docker network connect testNet1 t1

show the resolv.conf again

# docker exec 53 cat /etc/resolv.conf
options ndots:0

some informations

# docker -v
Docker version 18.03.1-ce, build 9ee9f40
# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.4 LTS
Release:	16.04
Codename:	xenial
# uname -a
Linux slt-docker 4.4.0-128-generic #154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux