在国产arm服务器KyLinV11操作系统部署harbor仓库时候遇到 502 Bad Gateway 问题
问题:502 Bad Gateway
?
1
2
3 |
docker login --username=xx --password=xxx 10.23.5.10:18023
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: login attempt to http: //xxx:18023/v2/ failed with status: 502 Bad Gateway
|
原因:registry容器因为权限问题导致异常重启
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 |
Appending internal tls trust CA to ca-bundle ...
find: '/etc/harbor/ssl' : No such file or directory
Internal tls trust CA appending is Done.
ls: /harbor_cust_cert: Permission denied
time= "2024-02-07T04:07:18.071313545Z" level=info msg= "debug server listening localhost:5001"
time= "2024-02-07T04:07:18.07219485Z" level=info msg= "using redis blob descriptor cache" go.version=go1.19.8 instance.id=ddd7db6e-e5ba-42de-8bc1-26655a607aea service=registry version=v2.8.0.m
panic: unable to configure authorization (htpasswd): open /etc/registry/passwd: permission denied
goroutine 1 [running]:
github.com/docker/distribution/registry/handlers.NewApp({0xa71940?, 0x4000483ef0?}, 0x4000101800)
/go/src/github.com/docker/distribution/registry/handlers/app.go:317 +0x191c
github.com/docker/distribution/registry.NewRegistry({0xa71940?, 0x4000483470?}, 0x4000101800)
/go/src/github.com/docker/distribution/registry/registry.go:161 +0x128
github.com/docker/distribution/registry.glob..func1(0x8?, {0x4000484730, 0x1, 0x1})
/go/src/github.com/docker/distribution/registry/registry.go:119 +0x160
github.com/docker/distribution/vendor/github.com/spf13/cobra.(*Command).execute(0xfd3f40, {0x40004846f0?, 0x2?, 0x2?})
/go/src/github.com/docker/distribution/vendor/github.com/spf13/cobra/command.go:495 +0x3ac
github.com/docker/distribution/vendor/github.com/spf13/cobra.(*Command).Execute(0xfd40e0)
/go/src/github.com/docker/distribution/vendor/github.com/spf13/cobra/command.go:560 +0x98
|
解决方式:给予文件权限(harbor由uid gid 10000的用户启动)
?
1 |
chown -R 10000.10000 ./common
|
在使用docker login命令报错502 Bad Gateway,基本都是相关服务没有正常启动,可以观察下服务运行日志,定位到问题处理即可