Skip to content

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

@AnkitaNaik

Description

@AnkitaNaik

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:

FROM python:3.11-slim


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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions