【DevOps】基于Nexus3部署Docker内网私有代理仓库docker proxy

nexus3权限配置

请参照上面的流程图,按照以下步骤进行检查:

  1. 确认 Docker Bearer Token Realm 已激活

    • 路径 :Nexus 控制台 → SecurityRealms
    • 检查 :确保 Docker Bearer Token Realm 出现在右侧的 Active 栏中。这是实现Docker仓库认证的关键安全模块,即使勾选了"Allow anonymous docker pull",如果此项未激活,匿名访问也会失败
  2. 检查匿名用户访问权限

    • 路径 :Nexus 控制台 → SecurityAnonymous Access
    • 检查 :确保选择了 Allow anonymous users to access the server。这样,未登录的客户端才被允许与仓库交互。
  3. 特别注意Podman客户端的差异

    • 你已经在使用 --tls-verify=false 来绕过HTTPS验证,这是正确的。因为Nexus仓库默认使用HTTP,而Podman对安全性的要求可能比Docker更严格。

创建docker(proxy)仓库

Name: docker-proxy

Repository Connectors:

HTTP: 8090

​ 勾选:Allow anonymous docker pull ( Docker Bearer Token Realm required )

​ 勾选:Allow clients to use the V1 API to interact with this repository

Proxy

​ Remote Storage:https://docker.1ms.run

​ Docker Index: Use proxy registry(specified above)

客户端使用(HTTP协议)

podman客户端

复制代码
[root@10-2-0-4 ~]# podman pull --tls-verify=false 10.2.0.100:8090/library/nginx:latest
Trying to pull 10.2.0.100:8090/library/nginx:latest...
Getting image source signatures
Copying blob 8da8ed3552af done
Copying blob b459da543435 done
Copying blob 5d8ea9f4c626 done
Copying blob 58d144c4badd done
Copying blob 54e822d8ee0c done
Copying blob 250b90fb2b9a done
Copying blob 8c7716127147 done
Copying config 07ccdb7838 done
Writing manifest to image destination
Storing signatures
07ccdb7838758e758a4d52a9761636c385125a327355c0c94a6acff9babff938

Docker客户端

配置/etc/docker/daemon.json

参考以下registry-mirrors、insecure-registries两项配置。

复制代码
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "registry-mirrors": ["http://10.2.0.100:8090"],
  "insecure-registries": ["http://10.2.0.100:8090"],
  "max-concurrent-downloads": 10,
  "log-driver": "json-file",
  "log-level": "warn",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
    },
  "data-root": "/var/lib/docker"
}

重启

复制代码
 systemctl restart docker

查看dockerinfo

复制代码
[root@10-2-0-4 ~]# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 18.09.0
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: systemd
Hugetlb Pagesize: 2MB, 2MB (default is 2MB)
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 871075eb7cc979944ba2d987719cb534bbb87e5c
runc version: N/A
init version: N/A (expected: )
Security Options:
 seccomp
  Profile: default
Kernel Version: 5.10.0-216.0.0.115.oe2203sp4.x86_64
Operating System: openEuler 22.03 (LTS-SP4)
OSType: linux
Architecture: x86_64
CPUs: 20
Total Memory: 14.8GiB
Name: 10-2-0-4
ID: 4DKE:4SMB:KYOE:DA4F:7QCU:CBK5:FL7D:WJFC:BIIA:EVBG:ZGI2:GQWR
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 10.2.0.100:8090
 127.0.0.0/8
Registry Mirrors:
 http://10.2.0.100:8090/
Live Restore Enabled: true

拉取镜像

复制代码
[root@10-2-0-4 ~]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
8c7716127147: Pull complete
250b90fb2b9a: Pull complete
5d8ea9f4c626: Pull complete
58d144c4badd: Pull complete
b459da543435: Pull complete
8da8ed3552af: Pull complete
54e822d8ee0c: Pull complete
Digest: sha256:3b7732505933ca591ce4a6d860cb713ad96a3176b82f7979a8dfa9973486a0d6
Status: Downloaded newer image for nginx:latest
相关推荐
天下不喵2 小时前
Ubuntu24.04安装Docker过程记录
docker
冷血~多好3 小时前
使用docker部署elk,实现日志追踪
elk·docker·容器
天一生水water4 小时前
docker-compose安装
运维·docker·容器
蓝象_4 小时前
docker安装配置mysql
mysql·docker·容器
一叶知秋yyds6 小时前
Centos 安装 Docker教程
linux·docker·centos
return(b,a%b);6 小时前
docker拉取失败,更换docker的源
docker·容器·eureka
IT小哥哥呀6 小时前
Jenkins + Docker 打造自动化持续部署流水线
docker·微服务·自动化·jenkins·springboot·高并发·限流
时鲟、时倾7 小时前
docker部署kafka
docker·容器·kafka
byte轻骑兵7 小时前
WSL+openEuler云原生实践:Docker全流程部署与多容器编排深度评测
docker·云原生·容器·openeuler
Knight_AL10 小时前
Docker 加载镜像时报 no space left on device 的彻底解决方案
docker·容器·eureka