MXBLOG - nexus
type: channel
link: https://moonjer.com/tag/nexus/
items: docker安装nexus,搭建docker镜像代理仓库

docker安装nexus,搭建docker镜像代理仓库
type: item
date: 2023-04-25T00:49:00+08:00
description: 一、安装Nexusdocker run -d --name nexus \ --restart=always \ --privileged=true \ -p 30024:8081 \ -p 30025:8082 \ -v /home/$USER/dockerfile/nexus/data/nexus-data:/nexus-data \ sonatype/nexus3:3.45.0{callout color="#f0ad4e"} 8081 端口为nexus本身服务的端口； 8082 端口为预留给docker镜像仓库使用的端口。{/callout}二、创建docker镜像仓库1.创建2.选择代理仓库3.填写信息4.添加docker权限5.创建角色和用户（仅使用代理功能无需创建）6.配置/etc/docker/daemon.json文件{ "registry-mirrors": [ "https://hub-mirror.c.163.com", "http://10.10.11.100:30025" ], "insecure-registries": ["10.10.11.100:30025"] }{callout color="#f0ad4e"}未配置该项，可能会报错误： Error response from daemon: Get https://: http: server gave HTTP response to HTTPS client {/callout}重载配置systemctl daemon-reload重启docker服务systemctl restart docker三、测试myuser@ubuntu:/etc/docker$ docker pull 10.10.11.100:30025/helloz/transmission:v1.3 v1.3: Pulling from helloz/transmission ba3557a56b15: Pull complete d9b286767b1b: Pull complete 90d275dc7c03: Pull complete 4cbcf4bbde0c: Pull complete Digest: sha256:2ac88659895b803a461f172efce5bf9f6812f2278a55cbe72d91d7675744d1e1 Status: Downloaded newer image for 10.10.11.100:30025/helloz/transmission:v1.3 10.10.11.100:30025/helloz/transmission:v1.3查看Nexus可以看到已经下载了该镜像