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

Nexus 制品库的介绍与安装 #53

Open
YIngChenIt opened this issue Jul 31, 2020 · 0 comments
Open

Nexus 制品库的介绍与安装 #53

YIngChenIt opened this issue Jul 31, 2020 · 0 comments

Comments

@YIngChenIt
Copy link
Owner

YIngChenIt commented Jul 31, 2020

Nexus 制品库的介绍与安装

介绍

制品库是承接CI构建后的产出制品的仓库, 具有版本管理,历史管理,权限校验等功能。

在这里,我们选用 Nexus3 作为制品库。

安装

拉取 Neuxs 镜像

docker pull sonatype/nexus3

启动 Nexus 容器

创建nexus文件夹,用来存放 nexus 相关数据

mkdir /home/nexus && chown -R 200 /home/nexus

启动容器

docker run -d -p 8081:8081 -p 8082:8082 \
--name nexus \
-v /home/nexus:/nexus-data \
--restart always \
sonatype/nexus3

Nexus 的主服务端口是8081,但 Nexus Docker 制品库还需要分配一个新的端口作为服务端口。 这里没有演示分配哪个端口,想分配自己加 -p 参数即可。在这里我使用8082作为 docker 服务端口

添加防火墙

firewall-cmd --zone=public --add-port=8081/tcp --permanent
firewall-cmd --zone=public --add-port=8082/tcp --permanent

配置 Nexus

我们通过8081打开nexus页面之后,需要登录,默认账号是admin,密码这样获取

cat /home/nexus/admin.password

登录制品库

我们的私有制品库制作完成之后,我们需要连接登录一下

vim /etc/docker/daemon.json

添加insecure-registries字段

{
  "insecure-registries" : [
    "xxxxx:8082"
  ],
}

保存退出,重启 Docker

systemctl restart docker

接着使用 docker login 命令尝试登录:

docker login 服务IP:端口

这里有个小坑,需要nexus配置一下,不然连接不上

image

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