docker部署
mkdir -p /app/nexus/data && \
chmod -R 777 /app/nexus/data && \
docker run -d -p 8081:8081 -p 8082:8082 -p 8083:8083 --name nexus -v /app/nexus/data:/nexus-data sonatype/nexus3:3.19.1
登录
按照指令和提示找到对应的密码,目录在nexus的data文件夹中
首次用户名是admin,password自己查看,登录后会强制重置当前密码
创建repository
选择docker(hosted)
进行如下配置
#使用docker连接nexus验证nexus是否正确搭建,在服务器上面连接docker私服
docker login -u admin 192.168.0.127:8082
#结果报错
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://124.70.187.52:8082/v2/: http: server g
需要在docker里面修改对应设置:
#在/etc/docker/目录下,创建daemon.json文件(如果有的话直接覆盖)。在文件中写入
{ "insecure-registries":["192.168.0.127:8082"],"registry-mirrors": ["https://gkn8mmeu.mirror.aliyuncs.com"]}
#或者直接执行
cat << EOF > /etc/docker/daemon.json
{"insecure-registries": ["192.168.0.127:8082"],"registry-mirrors": ["https://gkn8mmeu.mirror.aliyuncs.com"]}
EOF
#加载配置文件,重启docker
systemctl daemon-reload
systemctl restart docker
#再次登录,成功返回
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded