无法连接到私有 Nexus 注册表

can not connect to private nexus registry

我在 macOS

上使用 docker-desktop(版本:Docker version 20.10.12, build e91ed57

我的问题:无法连接映像并将其推送到 Nexus 注册表容器

这是我的步骤和错误:

  1. 拉取并启动 nexus 容器

    docker 卷创建 --name nexus-data

    docker 运行 -d -p 8081:8081 --name nexus -v nexus-data:/nexus-dasonatype/nexus3:3.37.3

  2. 连接到 0.0.0.0:8081

然后我连接到 0.0.0.0:8081 并创建一个 docker-hosted 存储库,并在 HTTP 部分添加 8083 端口。

然后我创建一个用户 (ali) 并为其分配密码和角色

  1. insecure-registries 添加到 docker 引擎

然后根据 this documentation 我将这一行添加到 docker engine:

"insecure-registries": ["0.0.0.0:8083"]
  1. 重新启动 docker 和容器
  2. 尝试登录

然后我尝试通过此命令登录:

docker login 0.0.0.0:8083

但它 return 一个错误:

Error response from daemon: Get "http://0.0.0.0:8083/v2/": dial tcp 0.0.0.0:8083: connect: connection refused

为什么我会收到这个错误?!

我尝试了很多方法来解决我的问题,包括:

但一点作用都没有!

我该怎么办?!

要从主机访问容器中的端口,需要发布它。所以运行命令应该是

docker run -d -p 8081:8081 -p 8083:8083 --name nexus -v nexus-data:/nexus-dasonatype/nexus3:3.37.3