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

オープン 初心者向け
#18 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
docker, python

調査の方向性

docker/Dockerfile.unified の 26 行目付近から始め、現在の python:3.11-slim ベースイメージと報告されている bookworm バリアントを比較します。setup.md の手順と make build を使って失敗を再現し、その後、選択したベースイメージの変更によって、Docker の DNS を手動で設定しなくても apt-get update が完了することを確認します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
79
フォーク
23
平均マージ
2日 7時間
マージ済み PR(30日)
3

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

IBM/vakra のほかの issue

IBM/vakra の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。