Dial tcp: lookup registry... on no such host

I’m using plugins/docker to build a container and push it to a private registry.

docker push command fails with the error:
dial tcp: lookup registry… on no such host

I have added registry hostname in /etc/hosts (on agent containers) and /etc/nsswitch.conf but it looks like nswwitch.conf is not taken into account.
I would like to avoid setting up a custom DNS as suggested in DNS Lookup fails inside plugins/docker build

Why plugins/docker is not taking into account /etc/nsswitch.conf and /etc/hosts files ?