Sonatype Nexus Repository Manager 使用 nexus-cli 进行镜像删除
1. 下载 nexus-cli 是个二进制文件,将其放到任意目录,养成好习惯还是放在 /usr/local/bin/目录下:
scp ./nexus-cli mn1:/usr/local/bin/
这里测试我就直接放在了 /root 目录下
2. nexus-cli 设置 Sonatype Nexus Repository Manager 的鉴权信息:
(base) [root@mn1 ~]./nexus-cli configure
Enter Nexus Host: http://192.168.1.143:8081
Enter Nexus Repository Name: docker-hosted
Enter Nexus Username: admin
Enter Nexus Password:
这会在用户目录下创建一个名为 .credentials 的文件,文件内容大致如下:
# .credentials
# Nexus Credentials
nexus_host = "http://192.168.1.143:8081"
nexus_username = "admin"
nexus_password = ""
nexus_repository = "docker-hosted"
3. 查询仓库中的镜像:
(base) [root@mn1 ~]./nexus-cli image ls
4. 删除镜像:
(base) [root@mn1 ~]./nexus-cli image delete -name 111 -tag 11