mkdir -p ~/nexus/data
chmod 777 -R ~/nexus
docker run --restart always -d -v ~/nexus/data:/nexus-data -p 8081-8089:8081-8089 --name nexus klo2k/nexus3
大约等待两分钟后通过浏览器访问 http://IP地址:8081 即可进入 Nexus 的管理界面
默认帐号为admin,默认密码可通过挂载的数据卷中的admin.password查看
编辑/etc/docker/daemon.json
{
"insecure-registries" : [ "10.7.127.154:8082" ]
}
systemctl daemon-reload
systemctl restart docker
找个镜像上传
docker pull 10.7.127.154:8082/nginx:latest
docker tag nginx:latest 10.7.127.154:8082/nginx:latest
docker push 10.7.127.154:8082/nginx:latest
如果出现 http: server gave HTTp response to HTTPs client
是因为:k3s去拉镜像的时候用的https,但是本地镜像服务不支持https,只支持http
解决办法:
将registries.yaml写入位于/etc/rancher/k3s目录下 每个节点都得配置!!!
mirrors:
"10.7.127.154:8082":
endpoint:
- "http://10.7.127.154:8082"
configs:
"10.7.127.154:8082":
auth:
username: "admin"
password: "admin123"
重启每个节点
master:
sudo systemctl restart k3s
work:
sudo systemctl restart k3s-agent