Skip to content

[Bug]: Cannot access internet urls during building [eg. crates.io] #656

Description

@Harokku

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

Try to build a container that need to compile a rust program as part of the building stage.

[Dockerfile] (extract):
FROM rust:1.90-slim as builder
RUN --mount=type=cache,target=/usr/local/cargo/registry
cargo build --release <- here where it fail

[Build command]:
container build --tag disc_arch --file Dockerfile .

Network and bridge seem ok, since container build can fetch OCI image from docker repository (see log)

Tried to debug with following dockerfile:
FROM alpine:latest
RUN ping -c 3 google.com

No response.

Current behavior

failed to download from https://index.crates.io

It seem it can't reach crates.io,

With simpler dockerfile DNS resolution work, it resolve google.com correctly (pingable from host, so no network issue in place)

Expected behavior

It should build (same host, same command in docker compile)

It should ping google.com in the second test

Environment

- OS: Version 26.0 (25A354)
- Xcode: Version 26.0 (17A324)
- Container: 0.4.1

Relevant log output

container build --tag disc_arch --file Dockerfile .
[+] Building 134.8s (9/11)
 => [resolver] fetching image...docker.io/library/rust:1.90-slim                                     0.0s
 => [resolver] fetching image...docker.io/library/debian:bookworm-slim                               0.0s
 => [internal] load .dockerignore                                                                    0.1s
 => => transferring context: 1.12kB                                                                  0.1s
 => oci-layout://docker.io/library/rust:1.90-slim@sha256:40d4ee109c7e740b3a242f20cc3b5790af9c725828  0.0s
 => => resolve docker.io/library/rust:1.90-slim@sha256:40d4ee109c7e740b3a242f20cc3b5790af9c725828b8  0.0s
 => [internal] load build context                                                                    1.2s
 => => transferring context: 188.56MB                                                                1.1s
 => CACHED oci-layout://docker.io/library/debian:bookworm-slim@sha256:df52e55e3361a81ac1bead266f337  0.0s
 => => resolve docker.io/library/debian:bookworm-slim@sha256:df52e55e3361a81ac1bead266f3373ee55d29a  0.0s
 => CACHED [linux/arm64/v8 builder 1/4] WORKDIR /app                                                 0.0s
 => CACHED [linux/arm64/v8 builder 2/4] COPY . .                                                     0.0s
 => ERROR [linux/arm64 builder 3/4] RUN --mount=type=cache,target=/usr/local/cargo/registry     c  131.2s
------
 > [linux/arm64 builder 3/4] RUN --mount=type=cache,target=/usr/local/cargo/registry     cargo build --release:
0.074     Updating crates.io index
30.09 warning: spurious network error (3 tries remaining): [28] Timeout was reached (Connection timed out after 30010 milliseconds)
61.17 warning: spurious network error (2 tries remaining): [28] Timeout was reached (Connection timed out after 30003 milliseconds)
94.68 warning: spurious network error (1 try remaining): [28] Timeout was reached (Connection timed out after 30010 milliseconds)
131.2 error: failed to get `hostname` as a dependency of package `disc_arch v0.1.0 (/app)`
131.2
131.2 Caused by:
131.2   download of config.json failed
131.2
131.2 Caused by:
131.2   failed to download from `https://index.crates.io/config.json`
131.2
131.2 Caused by:
131.2   [28] Timeout was reached (Connection timed out after 30010 milliseconds)
------
Error: unknown (2): failed to solve: process "/bin/sh -c cargo build --release" did not complete successfully: exit code: 101

------
Second dockerfile output:
[+] Building 13.4s (4/4) FINISHED
 => [resolver] fetching image...docker.io/library/alpine:latest                                      0.0s
 => [internal] load .dockerignore                                                                    0.1s
 => => transferring context: 1.12kB                                                                  0.1s
 => CACHED oci-layout://docker.io/library/alpine:latest@sha256:4bcff63911fcb4448bd4fdacec207030997c  0.0s
 => => resolve docker.io/library/alpine:latest@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea  0.0s
 => ERROR [linux/arm64 1/2] RUN ping -c 3 google.com                                                12.1s
------
 > [linux/arm64 1/2] RUN ping -c 3 google.com:
0.061 PING google.com (216.58.204.238): 56 data bytes
12.07
12.07 --- google.com ping statistics ---
12.07 3 packets transmitted, 0 packets received, 100% packet loss
------
Error: unknown (2): failed to solve: process "/bin/sh -c ping -c 3 google.com" did not complete successfully: exit code: 1

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomershelp wantedExtra attention is needednetworkIssues and features associated with networking and DNS.

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions