Skip to content

Commit c685f2f

Browse files
elchenbergaauren
authored andcommitted
feat(Dockerfile): add checks for required binaries
Check for the existence of the required iptables-* binaries before runnig the iptables-wrapper-installer. Signed-off-by: elchenberg <[email protected]>
1 parent b1cc158 commit c685f2f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,17 @@ COPY --from=builder /build/cni-download /usr/libexec/cni
4242
COPY build/image-assets/iptables-wrapper-installer.sh /
4343
# This is necessary because of the bug reported here: https://github.com/flannel-io/flannel/pull/1340/files
4444
# Basically even under QEMU emulation, it still doesn't have an ARM kernel in-play which means that calls to
45-
# iptables-nft will fail in the build process. The sanity check here only makes sure that we are not using
46-
# iptables-1.8.0-1.8.2. For now we'll manage that on our own.
47-
RUN /iptables-wrapper-installer.sh --no-sanity-check
48-
45+
# iptables-nft will fail in the build process. The sanity check here only makes sure that iptables-nft and iptables-legacy
46+
# are installed and that we are not using iptables-1.8.0-1.8.3. For now we'll manage that on our own.
47+
RUN if ! command -v iptables-nft > /dev/null; then \
48+
echo "ERROR: iptables-nft is not installed" 1>&2; \
49+
exit 1; \
50+
fi && \
51+
if ! command -v iptables-legacy > /dev/null; then \
52+
echo "ERROR: iptables-legacy is not installed" 1>&2; \
53+
exit 1; \
54+
fi && \
55+
/iptables-wrapper-installer.sh --no-sanity-check
4956

5057
# Since alpine image doesn't contain /etc/nsswitch.conf, the hosts in /etc/hosts (e.g. localhost)
5158
# cannot be used. So manually add /etc/nsswitch.conf to work around this issue.

0 commit comments

Comments
 (0)