docker学习(五) 使用nexus管理docker镜像

使用nexus管理docker镜像

使用nexus管理docker镜像,这里nexus在windows下部署的,linux下的部署类似,下载对应的版本,解压运行就好了。

1 下载nexus。下载地址,这里下载下载windows版本,需要JDK1.8及以上。

2 运行。 解压nexus, 修改JVM配置,路径在bin/nexus/nexus.vmoptions

-Xms1200M
-Xmx1200M
-XX:MaxDirectMemorySize=2G
-XX:+UnlockDiagnosticVMOptions
-XX:+UnsyncloadClass
-XX:+LogVMOutput
-XX:LogFile=../sonatype-work/nexus3/log/jvm.log
-XX:-OmitStackTraceInFastThrow
-Djava.net.preferIPv4Stack=true
-Dkaraf.home=.
-Dkaraf.base=.
-Dkaraf.etc=etc/karaf
-Djava.util.logging.config.file=etc/karaf/java.util.logging.properties
-Dkaraf.data=../sonatype-work/nexus3
-Djava.io.tmpdir=../sonatype-work/nexus3/tmp
-Dkaraf.startLocalConsole=false

修改地址端口路径在etc/nexus-default.properties

## DO NOT EDIT - CUSTOMIZATIONS BELONG IN $data-dir/etc/nexus.properties
##
# Jetty section
application-port=8081
application-host=192.168.1.4
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/

# Nexus section
nexus-edition=nexus-pro-edition
nexus-features=\
 nexus-pro-feature

在bin路径下运行 nexus /run

启动日志在sonatype-work\nexus3\log\nexus.log

3 创建docker repository

访问 http:[ip]:[port], 登陆,用户名密码默认 admin/admin123,创建一个用户。

这里写图片描述

创建一个角色,将nx-all权限赋予这个角色,
这里写图片描述

将创建的角色赋予创建的用户

这里写图片描述

创建一个repository ,店家 create repository
这里写图片描述

选择 docker(hosted),输入一个端口号。至于group,proxy可以查询对应的方式的资料。

这里写图片描述

至此,一个docker repository就创建成功。

4 将docker镜像push到nexus。

将一个创建好的镜像,打一个tag ,下面的IP是nexus repositoy的IP,port是其端口,

docker tag [oldImageName]:[tag]  [ip]:[port]/[newImageName]:[newTag]

运行docker login ,用户密码就是nexus的用户密码。
运行 docker push [ip]:[port]/[newImageName]:[newTag]

上一篇 配置阿里云镜像加速器

下一篇 使用maven构建springboot docker镜像并push到nexus

猜你喜欢

转载自blog.csdn.net/u011943534/article/details/81331231
今日推荐