原文地址: http://www.cnblogs.com/wzy5223/p/5410990.html

Nexus 3.0 可以创建三种docker仓库:

1. docker (proxy)      代理和缓存远程仓库 ,只能pull

2. docker (hosted)    托管仓库 ,私有仓库,可以push和pull

3. docker (group)      将多个proxy和hosted仓库添加到一个组,只访问一个组地址即可,只能pull

一. 配置Nexus 3.0

 经过测试, Nexus必须启动https,否则只能通过localhost登陆,hosted仓库也不能push。https证书可以到CA购买,也可以用自签名证书。 

首先配置JVM1.8 ,下载安装Nexus 3.0,nexus-3.0.0-03-unix.tar.gz 。(下载需要代理,我已经上传到云盘:http://pan.baidu.com/s/1eRZesQe)

解压压缩包以后,切换到解压目录,运行下面的命令就能启动

./bin/nexus run  或者  ./bin/nexus start

在启动之前需要先修改配置文件: (红色字体)

1. 开启监听ssl协议端口

cat > etc/org.sonatype.nexus.cfg <<EOF
# Jetty section
application-port-ssl=8443
application-port=8081
application-host=0.0.0.0
nexus-args=${karaf.etc}/jetty.xml,${karaf.etc}/jetty-http.xml,${karaf.etc}/jetty-requestlog.xml,${karaf.etc}/jetty-https.xml,${karaf.etc}/jetty-http-redirect-to-https.xml
nexus-context-path=/ # Nexus section
nexus-edition=nexus-oss-edition
nexus-features=\
nexus-oss-feature
EOF

2. 生成证书秘钥

NEXUS_DOMAIN=nexus 没有可以随便写
NEXUS_IP_ADDRESS=192.168.31.135 你的IP mkdir etc/ssl
cd etc/ssl
keytool -genkeypair -keystore keystore.jks -storepass nexus3 -keypass nexus3 -alias jetty -keyalg RSA -keysize 2048 -validity 5000 -dname "CN=*.${NEXUS_DOMAIN}, OU=Example, O=Sonatype, L=Unspecified, ST=Unspecified, C=US" -ext "SAN=DNS:${NEXUS_DOMAIN},IP:${NEXUS_IP_ADDRESS}" -ext "BC=ca:true"

3. 修改etc/jetty-https.xml ,红色字体

    <Set name="KeyStorePath"><Property name="karaf.etc"/>/ssl/keystore.jks</Set>
<Set name="KeyStorePassword">nexus3</Set>
<Set name="KeyManagerPassword">nexus3</Set>
<Set name="TrustStorePath"><Property name="karaf.etc"/>/ssl/keystore.jks</Set>
<Set name="TrustStorePassword">nexus3</Set>

4. 启动Nexus3.0

./bin/nexus run

5. 在运行docker的机器上信任nexus的证书, ubuntu系统

keytool -printcert -sslserver ${NEXUS_IP_ADDRESS}:8443 -rfc >nexus.crt
sudo mv nexus.crt /usr/local/share/ca-certificates/nexus.crt
sudo update-ca-certificates

6. 重启docker

sudo service docker restart

二. 创建docker代理仓库, docker (proxy)

访问Nexus的主页,https://192.168.31.135:8443 ,(注,自签名证书需要在浏览器将地址添加到白名单,访问http协议的8081端口会自动跳转)

用管理员登陆,用户名/密码 : admin/admin123,创建docker (proxy)仓库,内容如下面修改:

Name: docker
HTTPS: 8888
Enable Docker V1 API: true 勾选下面的复选框
Remote storage: https://registry-1.docker.io
Docker Index: Use Docker Hub
Blob store: default

修改完成以后登陆代理仓库, 用户名密码: admin/admin123

docker login ${NEXUS_IP_ADDRESS}:8888

然后可以用下面的命令搜索和下载docker镜像

docker search ${NEXUS_IP_ADDRESS}:8888/hello-world

docker pull ${NEXUS_IP_ADDRESS}:8888/hello-world

下载成功以后,可以看到hello-world镜像已经缓存在nexus上了,其它机器再次下载速度就会快很多。

FW nexus docker的更多相关文章

  1. nexus docker 私有镜像处理

    新版本的nexus 可以进行docker 镜像的存储处理 配置私有镜像(host 模式) 修改docker 非安全镜像处理 { "registry-mirrors": [" ...

  2. docker nexus oss

    docker login/search x.x.x.x:8081 sonatype/docker-nexus Docker images for Sonatype Nexus with the Ora ...

  3. docker --Nexus仓库

    Nexus 简介 Nexus 是个仓库管理器,目前主要分2大版本:2.X 和 3.X.2.X 主要支持的格式是Maven.P2.OBR.Yum.3.X主要支持的是Docker.NuGet.npm.Bo ...

  4. 用Docker搭建Nexus私服

    搜索Nexus 在docker容器中加载Nexus镜像 发布本地项目到Nexus私服 配置连接方式 发布指令 打源码包上传插件 搜索Nexus   在我们打算使用Nexus时,我们先搜索一下docke ...

  5. dubbo循序渐进 - 使用Docker安装Nexus

    docker search nexus docker pull docker.io/sonatype/nexus3 mkdir -p /usr/local/nexus3/nexus-data /usr ...

  6. 使用Nexus搭建私有Nuget仓库

    前言 Nuget是ASP .NET Gallery的一员,是免费.开源的包管理工具,专注于在.Net / .Net Core应用开发过程中第三方组件库的管理,相对于传统单纯的dll引用要方便.科学得多 ...

  7. CentOS docker 常用命令

    yum install docker 安装服务 systemctl start docker.service 启动服务 systemctl enable docker.service 开机启动服务 d ...

  8. Docker 系列四(自定义仓库).

    一.Docker hub 交互 Docker hub 是 Docker 官方维护的一个公共仓库,大部分需求都可以通过在 Docker hub 中直接下载镜像来完成.接下来,来看一下怎么与 Docker ...

  9. Docker初次使用与安装过程

    Docker入门 Docker 简介 Docker有两个版本: 社区版(CE) 企业版(EE) Docker Community Edition(CE)非常适合希望开始使用Docker并尝试使用基于容 ...

随机推荐

  1. HTML-Canvas02

    文字对齐方式 : 水平对齐 //是用 textAlign 属性设置水平对齐方式(默认坐标点) ctx.textAlign = "start"; ctx.font = "3 ...

  2. A jubeat

    Time Limit:1000MS  Memory Limit:65535K 题型: 编程题   语言: 无限制 描述 jubeat是一款由日本KONAMI倾心打造的体感音乐游戏,该作在日韩.香港等地 ...

  3. [leetCode][012] Two Sum (1)

    [题目]: Given an array of integers, find two numbers such that they add up to a specific target number ...

  4. TYVJ P1075 硬币游戏 Label:dp

    背景 农民John的牛喜欢玩硬币,所以John就为它们发明了一个新的两人硬币游戏,叫做Xoinc. 描述 最初地面上有一堆n个硬币(5<=n<=2000),从上面数第i个硬币的价值为C_i ...

  5. HttpClient_javax.net.ssl.SSLHandshakeException: sun.security.validator 问题解决,与环境有关

    用httpclient访问https 资源时,会出现异常,与环境也有关系,有些机器请求正常. javax.net.ssl.SSLHandshakeException: sun.security.val ...

  6. Redis中7种集合类型应用场景

    StringsStrings 数据结构是简单的key-value类型,value其实不仅是String,也可以是数字.使用Strings类型,你可以完全实现目前 Memcached 的功能,并且效率更 ...

  7. ckeditor的详细配置

    CKEditor 3 JavaScript API Documentation : http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.con ...

  8. hdu Strange fuction

    本题是一道二分题,但是要利用导数来求最小值.对原函数进行求导,得到的导函数为f(x)=42*pow(x,6)+48*pow(x,5)+21*pow(x,2)+10*x-y;因为0<=x<= ...

  9. Git Shell使用笔记

    1,首次打开Git shell错误(以前打开过gethub客户端) 警告: git command could not be found. Please create an alias or add ...

  10. Markdown基本用法

    Markdown基本用法 不同的编辑器对本文中的功能可能显示情况不一样,马克飞象可以完美支持和显示. 一.标题 h1标题 #h1标题 h1标题 h1标题 == h2标题 ##h2标题 h2标题 h2标 ...