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

SSL certificate problem: unable to get local issuer certificate #20

Closed
dry4ng opened this issue Mar 1, 2018 · 5 comments
Closed

SSL certificate problem: unable to get local issuer certificate #20

dry4ng opened this issue Mar 1, 2018 · 5 comments

Comments

@dry4ng
Copy link

dry4ng commented Mar 1, 2018

I'm getting the following error when trying to build docker image:

  Installing myapp v0.1.0 (file:///usr/src/myapp)
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading sqlite v0.23.9
error: failed to compile `myapp v0.1.0 (file:///usr/src/myapp)`, intermediate artifacts can be found at `/usr/src/myapp/target`

Caused by:
  unable to get packages from source

Caused by:
  [60] Peer certificate cannot be authenticated with given CA certificates (SSL certificate problem: unable to get local issuer certificate)
The command '/bin/sh -c cargo install' returned a non-zero code: 101

Here is my dockerfile:

FROM rust:1.24.0

WORKDIR /usr/src/myapp
COPY myapp/ .

RUN cargo install

CMD ["myapp"]
@sfackler
Copy link
Member

sfackler commented Mar 1, 2018

Is your network intercepting and decrypting network traffic? You'll have to add the interceptor's root certificate to the container's CA roots if so.

@dry4ng
Copy link
Author

dry4ng commented Mar 1, 2018

Same thing happens in different networks. Also curl succeeds against the same URL when building image:

Step 4/5 : RUN curl https://github.com/rust-lang/crates.io-index
 ---> Running in 385e449e893c
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0

<!DOCTYPE html>
...

@sfackler
Copy link
Member

sfackler commented Mar 1, 2018

I can't reproduce this locally unfortunately:

$ cat myapp/Cargo.toml
[package]
name = "myapp"
version = "0.1.0"
authors = ["Steven Fackler <sfackler@palantir.com>"]

[dependencies]
sqlite = "0.23"

$ cat Dockerfile
FROM rust:1.24.0

WORKDIR /usr/src/myapp
COPY myapp/ .

RUN cargo install

CMD ["myapp"]

$ docker build .
Sending build context to Docker daemon  15.87kB
Step 1/5 : FROM rust:1.24.0
1.24.0: Pulling from library/rust
3e731ddb7fc9: Already exists
47cafa6a79d0: Already exists
79fcf5a213c7: Already exists
68e99216b7ad: Already exists
4822563608bb: Already exists
e83f919da9f7: Pull complete
Digest: sha256:6575db28ff10d855805336895cb8303747624239bd9cffcbaa6fd50f046fa489
Status: Downloaded newer image for rust:1.24.0
 ---> f20935025f75
Step 2/5 : WORKDIR /usr/src/myapp
Removing intermediate container 45e4b58c60fc
 ---> 962f3da917d7
Step 3/5 : COPY myapp/ .
 ---> b7b1b173de29
Step 4/5 : RUN cargo install
 ---> Running in 2c767ff243fd
  Installing myapp v0.1.0 (file:///usr/src/myapp)
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading sqlite v0.23.9
 Downloading sqlite3-sys v0.12.0
 Downloading libc v0.2.37
 Downloading sqlite3-src v0.2.9
 Downloading pkg-config v0.3.9
 Downloading cc v1.0.4
   Compiling cc v1.0.4
   Compiling libc v0.2.37
   Compiling pkg-config v0.3.9
   Compiling sqlite3-src v0.2.9
   Compiling sqlite3-sys v0.12.0
   Compiling sqlite v0.23.9
   Compiling myapp v0.1.0 (file:///usr/src/myapp)
    Finished release [optimized] target(s) in 6.1 secs
  Installing /usr/local/cargo/bin/myapp
Removing intermediate container 2c767ff243fd
 ---> 576fc8a307f8
Step 5/5 : CMD ["myapp"]
 ---> Running in e1a0ec3a29e5
Removing intermediate container e1a0ec3a29e5
 ---> edeb1f35749b
Successfully built edeb1f35749b

@dry4ng
Copy link
Author

dry4ng commented Mar 1, 2018

Ok I have switched to LTE network and it worked. So you were right originally. Though I still don't understand why it works for curl.

@dry4ng dry4ng closed this as completed Mar 1, 2018
@sfackler
Copy link
Member

sfackler commented Mar 1, 2018

The image could connect to github as well - the crate downloads are on static.crates.io.

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

2 participants