环境及软件版本
OS
CentOS Linux release 7.4.1708 (Core)
nexus
OSS 3.6.0-02
docker –version
Docker version 1.12.6, build 85d7426/1.12.6
第一步 nexus 开启https
-因 docker默认使用 https链接,虽然有配置用http 但是推荐用https 还有是设置参数没成功
nexus 开启 https访问
1自签证书生成
cd /home/nexus/soft/nexus-3.6.0-02/etc/ssl
keytool -genkeypair -keystore keystore.jks -storepass changeit -keypass changeit -alias jetty -keyalg RSA -keysize 2048 -validity 5000 -dname “CN=*.nexus, OU=Example, O=Sonatype, L=Unspecified, ST=Unspecified, C=US” -ext “SAN=DNS:nexus,IP:192.168.xx.xx” -ext “BC=ca:true”
2 修改nexus 配置
2.1 /home/nexus/soft/sonatype-work/nexus3/etc/nexus.properties
参考
# Jetty section
# application-port=8081
# application-host=0.0.0.0
# nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
# nexus-context-path=/
secureScheme=https
securePort=9443
application-port-ssl=9443
application-host=192.168.xx.xx
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml,${jetty.etc}/jetty-https.xml
# Nexus section
# nexus-edition=nexus-pro-edition
# nexus-features=
# nexus-pro-feature
2.2 修改 jetty-https.xml
/home/nexus/soft/nexus-3.6.0-02/etc/jetty/jetty-https.xml
参考修改片段
/keystore.jks
changeit
changeit
changeit
2.3 重启nexus
访问 https:IP:port
/home/nexus/soft/nexus-3.6.0-02/bin/nexus stop
/home/nexus/soft/nexus-3.6.0-02/bin/nexus start
2.4 新建docker 库
参考图片配置

到此 nexus 配置设置完成
第二步 docker 环境配置
必须把自签证书加入到docker环境受信任不然会 如下错
Error response from daemon: Get https://192.168.xx.xx:9445/v1/users/: x509: certificate signed by unknown authority
导出证书
cd xxx/xx/store/
keytool -printcert -sslserver 192.168.xx.xx:9445 -rfc >nexus.crt
cp nexus.crt /etc/pki/ca-trust/source/anchors/
update-ca-trust extract
更改host
vi /etc/hosts
192.168.xx.xx nexus
重启docker demon
service docker stop
service docker start
第三步 登录 – 忽略了nexus 新建账 步骤 假设你账 已经建立
docker login -u user -p password nexus:9445
or
# docker login nexus:9445
Username: admin
Password:
Login Succeeded
参考:
https://support.sonatype.com/hc/en-us/articles/217542177-Using-Self-Signed-Certificates-with-Nexus-Repository-Manager-and-Docker-Daemon
https://help.sonatype.com/display/NXRM3/Configuring+SSL
文章知识点与官方知识档案匹配,可进一步学习相关知识云原生入门技能树首页概览8824 人正在系统学习中
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!