Skip to content

[Bug]: Could not resolve github.com in ubuntu container #283

@martin0258

Description

@martin0258

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

Env

Machine: M1 Macbook Air
OS: MacOS 15.5

container version:

container --version
container CLI version 0.2.0 (build: release, commit: 3b5c253)

IPs info

  • container ls > buildkit container's IP ADDR: 192.168.79.2
  • ifconfig > bridge100 inet: 192.168.79.1
  • container inspect buildkit | jq '.[0].configuration.dns.nameservers': 192.168.79.1

Steps to reproduce

Originally this happened when I tried to build an image (see details below) with a Dockerfile which has a RUN command curl -LO https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn_1.22.19_all.deb. Afterwards, I found it also happened with the following steps:

  1. Start a container container run --rm -it ubuntu
  2. In container's bash
apt-get update && apt-get install curl -y
curl https://github.com
# curl: (6) Could not resolve host: github.com

Note: I also tried curl https://www.apple.com in container and it worked.

Current behavior

More details about the steps to reproduce

With the IPs above, running container build with a Dockerfile having a command apt-get update worked and resolved ubuntu.com on my side, but failed to resolve github.com when my Dockerfile has a RUN command curl -LO https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn_1.22.19_all.deb.

When the buildkit nameserver IP is consistent with my subnet, not sure why it could resolve ubuntu.com with apt-get but failed to resolve github.com with curl?

Dockerfile FYR:

FROM ubuntu

RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
        unzip curl gnupg libgfortran5 libgbm1 tzdata netcat \
        libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 \
        libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libx11-6 libx11-xcb1 libxcb1 \
        libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 \
        libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release \
        xdg-utils git build-essential ffmpeg && \
    mkdir -p /etc/apt/keyrings && \
    curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
    echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
    apt-get update && \
    # Install node and yarn
    apt-get install -yq --no-install-recommends nodejs && \
    curl -LO https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn_1.22.19_all.deb \
        && dpkg -i yarn_1.22.19_all.deb \
        && rm yarn_1.22.19_all.deb

# ...

Error message:

72.02 Preparing to unpack .../nodejs_18.20.6-1nodesource1_arm64.deb ...
72.02 Unpacking nodejs (18.20.6-1nodesource1) ...
73.83 Setting up nodejs (18.20.6-1nodesource1) ...
73.85   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
73.85                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: github.com

Expected behavior

curl https://github.com should work in the container.

Environment

- OS: macOS 15.5
- Container: 0.2.0 (build: release, commit: 3b5c253)
- Machine: M1 Macbook Air

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions