`make build` fails during Docker `apt-get update` due to DNS resolution issues

Aperta Adatta ai principianti
#18 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
docker, python

Direzione di ricerca

Inizia da docker/Dockerfile.unified intorno alla riga 26 e confronta l’immagine di base attuale python:3.11-slim con la variante bookworm segnalata. Riproduci il problema seguendo le istruzioni di setup.md ed eseguendo make build, quindi verifica che la modifica selezionata all’immagine di base completi apt-get update senza configurazione manuale del DNS di Docker.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug Report: make build fails during Docker apt-get update due to DNS resolution issues

Describe the bug

The make build command documented in setup.md has been consistently failing during the Docker build step when running apt-get update.

The failure appears to be related to DNS resolution inside the Docker container while attempting to reach Debian package repositories (deb.debian.org).

This issue has been reproducible across three separate VMs with Linux OS.

The failing step is:

RUN apt-get update && apt-get install -y --no-install-recommends \
    gcc curl \
    && rm -rf /var/lib/apt/lists/*

The issue seems to originate from the base image currently used in the Dockerfile:

FROM python:3.11-slim

I was able to work around the issue by switching to:

FROM python:3.11-slim-bookworm

Relevant Dockerfile reference:

https://github.com/IBM/vakra/blob/0ef60d014e713e51476ceb8bef54c98615ef4e7e/docker/Dockerfile.unified#L26


To Reproduce

Steps to reproduce the behavior:

  1. Clone the repository:

    git clone https://github.com/IBM/vakra.git
    cd vakra
    
  2. Follow the setup instructions from setup.md.

  3. Run:

    make build
    
  4. Observe the Docker build failure during:

    apt-get update
    

Expected behavior

make build should complete successfully without requiring manual Docker DNS configuration or modification of the base image.


Screenshots

Image

Additional context

I tested this on three different VMs and encountered the same issue consistently.

Temporary workaround that resolved the issue:

1. Change the base image

Replace:

FROM python:3.11-slim

with:

FROM python:3.11-slim-bookworm
2. Test DNS resolution manually inside Docker
docker run --rm --dns 8.8.8.8 python:3.11-slim-bookworm getent hosts deb.debian.org

This succeeded, indicating the issue is related to Docker/container DNS resolution.

3. Configure Docker daemon DNS
sudo mkdir -p /etc/docker

sudo tee /etc/docker/daemon.json <<'EOF'
{
  "dns": ["8.8.8.8", "1.1.1.1"]
}
EOF

sudo systemctl restart docker

After applying the above DNS configuration, make build succeeded.

Lingua principale
Python
Stelle
79
Fork
23
Merge medio
2g 7h
PR unite (30g)
3

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di IBM/vakra

Tutte le issue di IBM/vakra

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.