Docker Build crashing and disconnecting the Azure Linux VM upon "RUN apk add --no-cache iptables bash"

Our Docker file:

FROM docker:18.09.6
ENV APP_NAME cs
ENV APP_INSTALL_PATH /opt/${APP_NAME}
WORKDIR ${APP_INSTALL_PATH}
COPY . .
RUN apk add --no-cache iptables bash
ENTRYPOINT [ "./script.sh" ]

When we run the sudo docker build -t test1 --no-cache .

Expected behavior

It should build the image named as test1

Actual behavior

  • Its not moving after this command → RUN apk add --no-cache iptables bash and the VM also gets disconnected.

Output:

Sending build context to Docker daemon  35.33kB
Step 1/7 : FROM docker:18.09.6
 ---> 934a309d24c1
Step 2/7 : ENV APP_NAME cs
 ---> Running in c1fb5de061db
Removing intermediate container c1fb5de061db
 ---> 1e08921f410e
Step 3/7 : ENV APP_INSTALL_PATH /opt/${APP_NAME}
 ---> Running in e24b5224d512
Removing intermediate container e24b5224d512
 ---> 64a71f9d2e02
Step 4/7 : WORKDIR ${APP_INSTALL_PATH}
 ---> Running in cb923df91de2
Removing intermediate container cb923df91de2
 ---> 61470d509e95
Step 5/7 : COPY . .
 ---> 2d2145d86a9d
Step 6/7 : RUN apk add --no-cache iptables bash
 ---> Running in 4c66e9fd3227

Thanks in Advance for the support.

1 Like

Wow, I’m tempted to assume that the combination FROM docker:18.09.6 and RUN apk add iptables affects the host network, and during build no less. :thinking: At least on Azure, which itself will be some virtualization…?

Did you try on a non-Azure Linux installation? And without iptables (so just RUN apk add --no-cache bash)? Or with the original RUN along with, say, FROM alpine:3.14? Also, I assume Docker in general works fine on your Azure VM?

(Aside, your build command works fine in Docker Desktop on a Mac, though I did not use sudo then. But Desktop on a Mac somehow adds its own virtual machine for that; I think Docker on Linux is just a thin layer, closely tied to the Linux host. Not my cup of tea, but very curious.)