CPE40 - How to to add static DNS Host entry to cpe40 container (/etc/hosts)
search cancel

CPE40 - How to to add static DNS Host entry to cpe40 container (/etc/hosts)

book

Article ID: 377604

calendar_today

Updated On:

Products

AppNeta

Issue/Introduction

Since Linux appears to only look at the first 3 entries of the resolv.conf, it's possible that the only dns resolvers that the default interface can reach will not be queried.

Example resolv.conf output, linux will only look at bolded configured nameservers.

root@cpe40:/# cat /etc/resolv.conf
nameserver <ip-address>
nameserver <ip-address>
nameserver <ip-address>
nameserver <ip-address>
nameserver <ip-address>
nameserver <ip-address>

Resolution

Option 1:

Setting a static value in /etc/hosts using docker command:

$ docker run --add-host=<FQDN>:<ip-address> --rm=true -ti debian:bookworm /bin/bash -i

Option 2:

Setting a static value in /etc/hosts using run-opt:

run-opt 5 "--add-host=<FQDN>:<ip-address>"