Cannot create Alpine container for DHCP helper

The guide DHCP with docker-compose and bridge networking is very well written and I think I followed all the steps correctly. But the alpine container seems to be unable to get an internet connection. I tried to add a custom mirror to make sure it's not a mirror related issue but it still won't work.
BEFORE:

Step 2/4 : RUN apk --no-cache add dhcp-helper
 ---> Running in a05cbbae0426
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/armv7/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/main: temporary error (try again later)
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/armv7/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/community: temporary error (try again later)

AFTER:

 ---> 399ad3d21895
Step 2/5 : RUN echo http://pkg.adfinis.com/alpine/latest-stable/main > /etc/apk/repositories;     echo http://pkg.adfinis.com/alpine/latest-stable/community >> /etc/apk/repositories; apk update
 ---> Running in 9e3901f78f6d
fetch http://pkg.adfinis.com/alpine/latest-stable/main/armv7/APKINDEX.tar.gz
ERROR: http://pkg.adfinis.com/alpine/latest-stable/main: temporary error (try again later)
WARNING: Ignoring http://pkg.adfinis.com/alpine/latest-stable/main: No such file or directory
fetch http://pkg.adfinis.com/alpine/latest-stable/community/armv7/APKINDEX.tar.gz
ERROR: http://pkg.adfinis.com/alpine/latest-stable/community: temporary error (try again later)
WARNING: Ignoring http://pkg.adfinis.com/alpine/latest-stable/community: No such file or directory

I tried this with my own compose file but tried it later with yours too. I also compared mine to yours with vimdiff to make sure that I do not have any syntax errors in my file.
The internet connection on the Pi itself works flawlessly.

My compose file looks like this and I'm building it with docker-compose up. I hope this is correct.:

version: "3"

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - "53:53/tcp"
      - "53:53/udp"
        #- "8080:80/tcp"
    dns:
      - 1.1.1.1
    environment:
      TZ: "${TZ}"
      WEBPASSWORD: "${WEBPASSWORD}"
      ServerIP: 192.168.0.10
      DNS1: 1.1.1.1
      DNS2: 1.0.0.1
      VIRTUAL_HOST: pi.hole
      DNSMASQ_LISTENING: all
    volumes:
      - '/opt/pihole/etc-pihole/:/etc/pihole/'
      - '/opt/pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/'
      - '/opt/pihole/var-log/pihole.log:/var/log/pihole.log'
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
    depends_on:
      - dhcphelper
    networks:
      backend:
        ipv4_address: '172.31.0.100'
      frontproxy_proxy-tier: {}

  dhcphelper:
    container_name: dhcphelper
    build: ./dhcp-helper
    restart: unless-stopped
    network_mode: "host"
    command: -s 172.31.0.100
    cap_add:
      - NET_ADMIN

networks:
  backend:
    ipam:
      config:
        - subnet: 172.31.0.0/16
  frontproxy_proxy-tier:
    external: true

For context: This does happen when Docker is trying to create the DHCP helper container using the following Dockerfile (as quoted from the guide):

FROM alpine:latest
RUN apk --no-cache add dhcp-helper
EXPOSE 67 67/udp
ENTRYPOINT ["dhcp-helper", "-n"]

Are you able to access https://dl-cdn.alpinelinux.org/alpine/v3.13/main/armv7/APKINDEX.tar.gz at all, e.g. by using a browser?

Yes. I am aware of that. I tried to adjust the Dockerfile to use a diffrent mirror but the problem stayed the same.

RUN echo http://pkg.adfinis.com/alpine/latest-stable/main > /etc/apk/repositories; echo http://pkg.adfinis.com/alpine/latest-stable/community >> /etc/apk/repositories; apk update

I'm able to access the site from my pi. It seems to be a problem with docker network as far as I can tell.

root@pi:# wget https://dl-cdn.alpinelinux.org/alpine/v3.13/main/armv7/APKINDEX.tar.gz
--2021-02-13 14:16:17--  https://dl-cdn.alpinelinux.org/alpine/v3.13/main/armv7/APKINDEX.tar.gz
Resolving dl-cdn.alpinelinux.org (dl-cdn.alpinelinux.org)... 2a04:4e42:3::645, 151.101.14.133
Connecting to dl-cdn.alpinelinux.org (dl-cdn.alpinelinux.org)|2a04:4e42:3::645|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 624104 (609K) [application/octet-stream]
Saving to: ‘APKINDEX.tar.gz’

APKINDEX.tar.gz                                     100%[=================================================================================================================>] 609.48K  --.-KB/s    in 0.1s

2021-02-13 14:16:18 (4.12 MB/s) - ‘APKINDEX.tar.gz’ saved [624104/624104]

If you can resolve that URL in general, that would suggest alpine to be involved.
Trying to get the results for your wget from within the container may provide more details on why its failing.

You could also try to base base your container on a specific alpine version rather than latest and see if that would fix you (i.e. if whatever version is referred to by latest introduced the behaviour you observe). Using a specific version is a good idea anyway.

As this isn't related to Pi-hole, you should also consider to consult additional sources, e.g. Docker's or Alpine's support.

1 Like

You're right. The probem seems to be with version 3.13. I changed it to 3.10 an now it works fine. Thanks for the fast help!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.