使用容器安装Nexus3

1.下载nexus3的镜像:

docker pull sonatype/nexus3

2.使用镜像启动一个容器:

docker run -d -p 8081:8081 -p 5000:5000 --name nexus3 -v /nexus-data:/nexus-data/ --restart=always sonatype/nexus3

要是启动不起来有可能是/nexus-data目录没有权限,把目录权限改为757

注:5000端口是用于镜像仓库的服务端口   8081 端口是nexus的服务端口

3.启动之后我们就可以通过http://服务器IP:8081访问。

默认账号密码为admin/admin123

创建Docker私有仓库

通过浏览器访问Nexus: 
http://服务器IP:8081

点击右上角进行登录,通过初始用户名和密码进行登录(admin/admin123):

点击设置界面,选择Repositories,点击Create repository,如下图所示:

选择仓库类型,这里Docker有三种类型,分别是group、hosted、proxy。这里只演示hosted类型,所以选择docker(hosted),如下图:

注:Docker镜像仓库类型含义解释如下:
  hosted : 本地存储,即同docker官方仓库一样提供本地私服功能

  proxy : 提供代理其他仓库的类型,如docker中央仓库

  group : 组类型,实质作用是组合多个仓库为一个地址

指定docker仓库的名称、指定一个端口用来通过http的方式进行访问仓库、勾选是否支持docker API V1,然后create repository;
Force basic authentication:这里最好也勾选

因为我们测试的时候不是使用加密的HTTPS进行访问,所以这里需要增加一个docker的启动参数,给他指定私库的地址,如下:

编辑/etc/docker/daemon.json 增加如下内容,当然也可通过启动参数增加,如果出现response https等错误,把http://去掉。

{

........, 
  "insecure-registries":["http://172.xx.xx.60:5000"]

}

重启docker进程: systemctl restart docker

查看docker信息: docker info ,有如下输出即正常

OSType: linux
Architecture: x86_64
Number of Docker Hooks:
CPUs:
Total Memory: 62.25 GiB
Name: .novalocal
ID: I4YA:R77P:4MMX:V76S:NL4J:XP42:WZFR:5UFD:QRNT:N4GD:54UV:KFXS
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Experimental: false
Insecure Registries:
172.xx.xx.60:
127.0.0.0/
Registry Mirrors:
https://aj2rgad5.mirror.aliyuncs.com
Live Restore Enabled: false
Registries: docker.io (secure)

登录私库

要使用私库进行上传下载需要进行登录连接到Nexus(物理机重启推拉不了镜像要重新docker logiin)

  docker login http://172.xx.xx.60:5000/

Docker上传镜像到私库

使用docker tag 对镜像进行管理(必须进行此项操作)

  docker tag使用格式:

    docker tag SOURCE_IMAGE[:TAG]  TARGET_IMAGE[:TAG]

  docker tag helolo-world 172.xx.xx.60:5000/hello:v1

  docker push 172.xx.xx.60:5000/hello:v1

示例:使用tag进行打标,正常上传的结果

[root@ docker]# docker pull 172.xx.xx.60:/hello:v1
Trying to pull repository .xx.xx.:/hello ...
v1: Pulling from 172.xx.xx.60:/hello
Digest: sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a
Status: Image is up to date for .xx.xx.:/hello:v1

不进行tag打标,会出现denied: requested access to the resource is denied报错

查看镜像

[root@ docker]# curl http://172.xx.xx.60:5000/v2/_catalog
{"repositories":["hello"]}
[root@ docker]#
[root@ ~]# curl http://172.xx.xx.60:5000/v2/hello/tags/list
{"name":"hello","tags":["v1"]}
[root@ ~]#

上传完成后,在nexus中对应的docker库中,即可看到此镜像

下载私库中的镜像

1、删除本地上例实验中的镜像(docker rmi 172.xx.xx.60:5000/hello:v1)

[root@ ~]# docker rmi .xx.xx.:/hello:v1
Untagged: .xx.xx.:/hello:v1
Untagged: .xx.xx.:/hello@sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a
[root@ ~]#

2、docker pull 172.xx.xx.60:5000/hello:v1

[root@ ~]# docker pull .xx.xx.:/hello:v1
Trying to pull repository .xx.xx.:/hello ...
v1: Pulling from .xx.xx.:/hello
Digest: sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a
Status: Downloaded newer image for .xx.xx.:/hello:v1
[root@ ~]#

删除私库中的镜像

命令有时候不灵通curl -I -X DELETE http://172.xx.xx.60:5000/v2/hello/manifests/sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a

可以回到浏览器Browse server里面删除

转摘:https://www.cnblogs.com/jihongjun/p/8968901.html

docker+Nexus Repository Manager 搭建私有docker仓库的更多相关文章

  1. 使用 Nexus Repository Manager 搭建私有docker仓库

    使用容器安装Nexus3 1.下载nexus3的镜像: docker pull sonatype/nexus3 2.使用镜像启动一个容器: docker run -d --name nexus  -- ...

  2. 【Docker】(4)搭建私有镜像仓库

    [Docker](4)搭建私有镜像仓库 说明 1. 这里是通过阿里云,搭建Docker私有镜像仓库. 2. 这里打包的镜像是从官网拉下来的,并不是自己项目创建的新镜像,主要测试功能 一.搭建过程 首先 ...

  3. 使用 Nexus Repository Manager 搭建 npm 私服

    目录 环境 下载与安装 添加npm仓库 配置与验证npm仓库 发布自己的包 Nexus开启启动 脚注 环境 windows10(1803) Nexus Repository Manager OSS 3 ...

  4. [转] 使用HTTPS在Nexus Repository Manager 3.0上搭建私有Docker仓库

    FROM: https://www.hifreud.com/2018/06/06/03-nexus-docker-repository-with-ssl/ 搭建方式 搭建SSL的Nexus官方提供两种 ...

  5. [转]Ubuntu18.04下使用Docker Registry快速搭建私有镜像仓库

    本文转自:https://blog.csdn.net/BigData_Mining/article/details/88233015 1.背景 在 Docker 中,当我们执行 docker pull ...

  6. Android业务组件化之Gradle和Sonatype Nexus搭建私有maven仓库

    前言: 公司的业务组件化推进的已经差不多三四个月的时间了,各个业务组件之间的解耦工作已经基本完成,各个业务组件以module的形式存在项目中,然后项目依赖本地的module,多少有点不太利于项目的并行 ...

  7. Maven私服搭建(Nexus Repository Manager 3)

    下载和安装 下载地址:https://help.sonatype.com/repomanager3/download 注意:Nexus Repository Manager 3是一个Java服务器应用 ...

  8. Nexus Repository Manager OSS 3.x 安装配置

    前言想要使用maven搭建项目,但是国内的网络环境可以想象,还有公司自己开发的jar包等问题,所以需要搭建一个maven的私服,这样便于管理. 找了一些教程,顺便记下来,当做笔记. 本文以Window ...

  9. Nexus Repository Manager 3(CVE-2019-7238) 远程代码执行漏洞分析和复现

    0x00 漏洞背景 Nexus Repository Manager 3是一款软件仓库,可以用来存储和分发Maven,NuGET等软件源仓库.其3.14.0及之前版本中,存在一处基于OrientDB自 ...

随机推荐

  1. [Bayes] Hist & line: Reject Sampling and Importance Sampling

    吻合度蛮高,但不光滑. > L= > K=/ > x=runif(L) > *x*(-x)^/K)) > hist(x[ind],probability=T, + xla ...

  2. [R]统计工具包

    Wilcoxon Rank Sum and Signed Rank Tests data <-read.csv('XX.csv') wilcox.test(data$value1, data$v ...

  3. JQuery EasyUI DataGrid获取当前行

    1.获取当前行索引 var rowIndex = $('#dg').datagrid('getRowIndex', row); 2.根据索引删除当前行 $('#dg').datagrid('delet ...

  4. VBA RemoveDuplicates方法去重复项

    RemoveDuplicates后边必须跟参数否则不起作用 ActiveSheet.Range("G21:R36").RemoveDuplicates Columns:=12, H ...

  5. Spring mvc 接口枚举类型数据格式化处理

    一.背景简述 首先,我们都知道枚举实例有两个默认属性,name 和 ordinal,可通过 name()和ordinal()方法分别获得.其中 name 为枚举字面量(如 MALE,FEMALE),o ...

  6. SharePoint 2013自定义Providers在基于表单的身份验证(Forms-Based-Authentication)中的应用

    由于项目的需要,登录SharePoint Application的用户将从一个统一平台中获取,而不是从Domain中获取,所以需要对SharePoint Application的身份验证(Claims ...

  7. Android超精准计步器开发-Dylan计步(申明:来源于网路)

    Android超精准计步器开发-Dylan计步(申明:来源于网路) 拿来借鉴学习,向原创者... 地址:http://blog.csdn.net/linglongxin24/article/detai ...

  8. WebSphere Application Server V8.5.5.0

    Downloadable files Abstract IBM WebSphere Application Server Version 8.5.5 Refresh Pack for all plat ...

  9. 记一次 mysql 启动没反应

    记一次 mysql 启动没反应 ,重启linux又可以启动 vim /var/log/mysqld.log 2018-02-04 13:22:49 28507 [ERROR] InnoDB: Cann ...

  10. .NET Core开发日志——Middleware

    熟悉ASP.NET架构的开发者一定对于HTTP Modules与HTTP Handlers不陌生.两者的作用主要是对网络请求执行特定的处理工作.而在.NET Core中,它们都被Middleware( ...