Internet connection during image building

Internet connection issues : must split build into two (or more) steps

I am using docker version 17.05.0-ce in my raspberry pi 3 with raspbian jessie installed. I am trying to learn a bit about docker, and use it for some investigation and personal projects. I’ve just read some tutorials about docker, just for starters. I’ve tried to follow them, but I’ve reached some problems. One particular problem that bothers me a little is the internet connection from a docker image while it is being built. It seems that if any container has connected to the internet during the process of building an image, the next container of the same image seems to lose the access to internet. This happens also if after building an image that has accessed internet then another one is built using the previous image and also trying to access internet. If after the first container or image that has accessed internet I reboot the system, then the continuing the building image is successful. Is this supposed to be this way?

I’m posting an Docker file that fails, and then the “same” Dockerfile split into two to build the same final image that works by creating the first image, then rebooting and then building the second final image.

Full:

FROM resin/raspberrypi3-debian:latest
# Enable systemd
ENV INITSYSTEM on

RUN apt-get update && \
    apt-get install -y apt-utils curl \
            ca-certificates \
            build-essential python3

WORKDIR /root/
RUN curl -LO \
  https://www.nodejs.org/dist/v6.11.1/node-v6.11.1-linux-armv6l.tar.xz

RUN tar xvf node-*.tar.xz -C /usr/local \
  --strip-components=1

CMD ["node"]

Split 1:

FROM resin/raspberrypi3-debian:latest
# Enable systemd
ENV INITSYSTEM on

RUN apt-get update && \
    apt-get install -y apt-utils curl \
            ca-certificates \
            build-essential python3

Split 2:

FROM basenode:arm

WORKDIR /root/
RUN curl -LO \
  https://www.nodejs.org/dist/v6.11.1/node-v6.11.1-linux-armv6l.tar.xz

RUN tar xvf node-*.tar.xz -C /usr/local \
  --strip-components=1

CMD ["node"]

Thansk for any help.

David.