create nsswitch-conf if missing (#9339)

This commit is contained in:
Long Wu Yuan 2022-11-25 14:58:06 +05:30 committed by GitHub
parent 04ce92338e
commit 9d562c47ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,13 @@ FROM registry.k8s.io/etcd:${ETCD_VERSION} as etcd
FROM ${BASE_IMAGE}
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
RUN set -eux; \
if [ -e /etc/nsswitch.conf ]; then \
grep '^hosts: files dns' /etc/nsswitch.conf; \
else \
echo 'hosts: files dns' > /etc/nsswitch.conf; \
fi
COPY --from=GO /usr/local/go /usr/local/go
COPY --from=etcd /usr/local/bin/etcd /usr/local/bin/etcd