我想在使用 SSL 探測的公司網路上使用 Earthly,該網路使用頒發自簽名證書的 SSL。我有自定義的 ca-cert pem 檔案,我已經成功地將其與其他工具和工具鏈(如 python、curl 等)一起使用。
不過,我無法用地球來配置它。檔案說這可以在地球上的配置中完成$HOME/.earthly/config.yml,所以我跟著它,我的組態檔看起來像
global:
buildkit_additional_args:
- "-v"
- "/Users/maca/.config/corporate/cert/cacerts"
無論我嘗試什么,我都會收到此錯誤
ongoing |
internal | --> GIT CLONE https://github.com/earthly/hello-world.git
internal | --> docker-image://docker.io/alpine/git:v2.30.1
internal | [ ] resolve docker.io/alpine/git:v2.30.1 ... 0%
internal | fatal: unable to access 'https://github.com/earthly/hello-world.git/': SSL certificate problem: self signed certificate in certificate chain
internal | WARN: (GIT CLONE https://github.com/earthly/hello-world.git) error fetching default branch for repository https://github.com/earthly/hello-world.git: exit status 128
internal | Completed in 121.889053ms
internal | WARN: Canceled
internal | Completed in 122.010694ms
internal | [██████████] resolve docker.io/alpine/git:v2.30.1 ... 100%
Summary of timing information
Note that the times do not include the expansion of commands like BUILD, FROM, COPY (artifact).
internal | () 243.899747ms
===============================================================
Total 243.899747ms
Total (real) 1m15.652038067s
Error stack trace:
github.com/moby/buildkit/util/stack.Enable
github.com/moby/[email protected]/util/stack/stack.go:77
github.com/moby/buildkit/util/grpcerrors.FromGRPC
github.com/moby/[email protected]/util/grpcerrors/grpcerrors.go:188
github.com/moby/buildkit/util/grpcerrors.UnaryClientInterceptor
github.com/moby/[email protected]/util/grpcerrors/intercept.go:41
google.golang.org/grpc.(*ClientConn).Invoke
google.golang.org/[email protected]/call.go:35
github.com/moby/buildkit/api/services/control.(*controlClient).Solve
github.com/moby/[email protected]/api/services/control/control.pb.go:1321
github.com/moby/buildkit/client.(*Client).solve.func2
github.com/moby/[email protected]/client/solve.go:215
golang.org/x/sync/errgroup.(*Group).Go.func1
golang.org/x/[email protected]/errgroup/errgroup.go:57
runtime.goexit
runtime/asm_amd64.s:1371
地球似乎忽略了我的 cacerts 檔案。有誰知道如何解決這個問題?
uj5u.com熱心網友回復:
您需要做的不僅僅是掛載 certs 目錄;Buildkit 不會選擇它們。要為注冊表指定自定義證書,您鏈接的檔案詳細說明了如何將自定義自簽名證書與單個 Docker 注冊表一起使用,而不是在整個構建中的更一般情況下。如果您需要使用自定義證書從注冊表中推送或拉取,您可以使用這些檔案。buildkit_additional_config如果需要在您的情況下進行配置,請不要忘記附加配置。
現在,為什么 hello-world失敗。該GIT CLONE命令git在幕后使用。雖然git在您的本地機器上可能配置為使用這些自定義證書,但git這里的內部構建是不同的,并且不共享相同的證書配置。您需要手動通過在證件帶來COPY,或使用--secret/ --secret-file/--build-arg使它訪問,這取決于你的使用情況。
我們的單元測驗中有一些例子涵蓋了這個用例。這是使用自定義證書通過 HTTPS 進行自定義克隆的方法;并且這里是我們如何添加自定義證書來構建。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/338634.html
