Sonatype Nexus OSS 构建私有docker 仓库

1.Docker Engine 配置

复制代码
{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "dns": [
    "8.8.8.8",
    "114.114.114.114"
  ],
  "experimental": false,
  "features": {
    "buildkit": true
  },
  "insecure-registries": [
    "localhost:31182",
    "localhost:31181"
  ],
  "registry-mirrors": [
    "http://localhost:31182",
    "http://localhost:31181"
  ]
}

insecure-registries:

在 Docker 中,insecure - registries是一个配置选项,用于指定被 Docker 视为不安全的容器镜像仓库。通常情况下,Docker 默认只信任通过 HTTPS 加密通信且具有有效证书的镜像仓库,这是为了确保镜像在传输过程中的安全性。但是,在某些开发或测试环境中,可能会使用未配置 HTTPS 或者使用自签名证书的镜像仓库,此时就需要将这些仓库添加到insecure - registries列表中。

registry-mirrors:

在 Docker 中,registry - mirrors是用于配置镜像仓库镜像(Mirror)的选项。镜像仓库镜像类似于一个缓存服务器,它存储了从原始镜像仓库(如 Docker Hub)获取的容器镜像副本。这样做的主要目的是为了加速容器镜像的下载过程,特别是当从原始仓库下载速度较慢或者网络不稳定时。

  1. 2. Docker 命令
bash 复制代码
#登录
docker login localhost:31182 -u admin

#打包
docker build . -t localhost:31182/repository/docker-hosted:v1.0

#推送 
docker push  localhost:31182/repository/docker-hosted:v1.0

#拉取
docker pull localhost:31182/repository/docker-hosted:v1.0
相关推荐
程序员-Benothing2 分钟前
Linux查找文件命令:find、locate、which、whereis实战
linux·运维·服务器
团子股股东峥哥12 分钟前
day39-RHEL-访问网络附加存储
linux·运维·服务器
流星白龙18 分钟前
【Docker】11.容器命令
docker
hhzz19 分钟前
OpenCV 入门到精通 09】特征检测与匹配:从 Harris 到 ORB 图像配准
人工智能·opencv·计算机视觉·开源·交互
名字还没想好☜30 分钟前
Kubernetes 用 kubectl port-forward 和 proxy 调试集群内服务:两者区别、断连自动重连与为什么别用在生产
运维·docker·kubernetes
程序员-Benothing2 小时前
Linux文件查看与编辑:cat、less、tail、vim快速入门
linux·运维·服务器
考虑考虑8 小时前
docker compose V2版本新属性
运维·后端·自动化运维
小小的木头人10 小时前
Ubuntu Samba修改端口绕过445封禁挂载
运维·ubuntu
March.s10 小时前
Docker 容器技术完全指南:从生态到架构的深度解析
docker
小弥儿10 小时前
GitHub今日热榜 | 2026-09-15:AI 智能体与本地生成工具领跑
学习·开源