Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Building with Docker Fails (Couldn't resolve host name) #91

Open
davidallendj opened this issue Mar 3, 2025 · 1 comment
Open

Comments

@davidallendj
Copy link

When running the docker build command mentioned in the README, I get the following error:

docker build -t manta .
[+] Building 41.6s (11/16)                                                                                                                                    docker:default
 => [internal] load build definition from Dockerfile                                                                                                                    0.1s
 => => transferring dockerfile: 849B                                                                                                                                    0.0s
 => WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1)                                                                                          0.1s
 => [internal] load metadata for docker.io/library/debian:bookworm-slim                                                                                                 6.8s
 => [internal] load metadata for docker.io/library/rust:1.72.1                                                                                                          6.9s
 => [internal] load .dockerignore                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                         0.0s
 => [builder 1/4] FROM docker.io/library/rust:1.72.1@sha256:911acdfd39276ead0dfb583a833f1db7d787ad0d5333848378d88f19e5fc158c                                            0.0s
 => CACHED [stage-1 1/7] FROM docker.io/library/debian:bookworm-slim@sha256:12c396bd585df7ec21d5679bb6a83d4878bc4415ce926c9e5ea6426d23c60bdc                            0.0s
 => [internal] load build context                                                                                                                                       0.2s
 => => transferring context: 474.61kB                                                                                                                                   0.1s
 => CANCELED [stage-1 2/7] RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*                                               34.4s
 => CACHED [builder 2/4] WORKDIR /usr/src/manta                                                                                                                         0.0s
 => CACHED [builder 3/4] COPY . .                                                                                                                                       0.0s
 => ERROR [builder 4/4] RUN cargo install --path .                                                                                                                     34.0s
------                                                                                                                                                                       
 > [builder 4/4] RUN cargo install --path .:                                                                                                                                 
0.355   Installing manta v1.54.31 (/usr/src/manta)                                                                                                                           
0.377     Updating crates.io index                                                                                                                                           
6.249 warning: spurious network error (3 tries remaining): [6] Couldn't resolve host name (Could not resolve host: index.crates.io)                                          
12.39 warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (Could not resolve host: index.crates.io)                                          
21.61 warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name (Could not resolve host: index.crates.io)                                          
33.90 error: failed to compile `manta v1.54.31 (/usr/src/manta)`, intermediate artifacts can be found at `/usr/src/manta/target`.                                            
33.90 To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
33.90 
33.90 Caused by:
33.90   failed to get `anyhow` as a dependency of package `manta v1.54.31 (/usr/src/manta)`
33.90 
33.90 Caused by:
33.90   failed to query replaced source registry `crates-io`
33.90 
33.90 Caused by:
33.90   download of config.json failed
33.90 
33.90 Caused by:
33.90   failed to download from `https://index.crates.io/config.json`
33.90 
33.90 Caused by:
33.90   [6] Couldn't resolve host name (Could not resolve host: index.crates.io)
------

 1 warning found (use docker --debug to expand):
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1)
Dockerfile:8
--------------------
   6 |     COPY . .
   7 |     # RUN cargo install --target x86_64-unknown-linux-gnu --path .
   8 | >>> RUN cargo install --path .
   9 |     
  10 |     # FROM debian:bullseye
--------------------
ERROR: failed to solve: process "/bin/sh -c cargo install --path ." did not complete successfully: exit code: 101
exit status 1

It looks like a name resolution failure, but I'm about to ping the host with no issue.

ping index.crates.io   
PING index.crates.io (2600:9000:20f4:4800:1f:a9f5:69c0:93a1) 56 data bytes
64 bytes from 2600:9000:20f4:4800:1f:a9f5:69c0:93a1: icmp_seq=1 ttl=53 time=23.1 ms
64 bytes from 2600:9000:20f4:4800:1f:a9f5:69c0:93a1: icmp_seq=2 ttl=53 time=24.5 ms
64 bytes from 2600:9000:20f4:4800:1f:a9f5:69c0:93a1: icmp_seq=3 ttl=53 time=31.6 ms
64 bytes from 2600:9000:20f4:4800:1f:a9f5:69c0:93a1: icmp_seq=4 ttl=53 time=23.9 ms
^C
--- index.crates.io ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 23.079/25.779/31.621/3.410 ms

Any ideas what may be causing this?

@davidallendj
Copy link
Author

I was able to get past this error by adding --network=host to the command. So now the command looks like docker build -t manta --network=host . instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant