用Docker搭建Nexus私服

搜索Nexus

  在我们打算使用Nexus时,我们先搜索一下docker景象仓库中现成的Nexus镜像。

docker search nexus

  其展示的结果如下:

[root@localhost ~]# docker search nexus
INDEX       NAME                                                   DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/sonatype/nexus                               Sonatype Nexus                                  379                  [OK]
docker.io   docker.io/sonatype/nexus3                              Sonatype Nexus Repository Manager 3             337                  
docker.io   docker.io/sonatype/docker-nexus3                       Sonatype Nexus 3 [DEPRECATED]                   27                   [OK]
docker.io   docker.io/clearent/nexus                                                                               21                   
docker.io   docker.io/baselibrary/nexus                            ThoughtWorks Docker Image: nexus                7                    [OK]
docker.io   docker.io/accenture/adop-nexus                         ADOP Nexus                                      5                    [OK]
docker.io   docker.io/bradbeck/nexus-https                         Dockerized version of Nexus Repo Manager 3...   5                    [OK]
docker.io   docker.io/frekele/nexus                                docker run --rm --name nexus -p 8081:8081 ...   4                    [OK]
docker.io   docker.io/shifudao/nexus3                              clone from nexus3 image but based from ope...   3                    [OK]
docker.io   docker.io/sonatype/nexus-iq-server                     Sonatype Nexus IQ Server                        3                    
docker.io   docker.io/cavemandaveman/nexus                         Sonatype Nexus container                        2                    [OK]
docker.io   docker.io/fabric8/nexus                                                                                2                    [OK]
docker.io   docker.io/madmuffin/nexus3                             Sonatype Nexus3 Milestone7 docker image         2                    [OK]
docker.io   docker.io/mcreations/jenkins-with-nexus-support        Jenkins image with correct SSL config for ...   1                    [OK]
docker.io   docker.io/openshiftdemos/nexus                         Sonatype Nexus with JBoss Enterprise repos...   1                    

  在这里,被大家使用频率越高的版本往往STARS指数越高,排位也就越靠前,这样,我们直接拉取第一个来使用就可以了。

docker pull docker.io/sonatype/nexus

  如下:

[root@localhost ~]# docker pull docker.io/sonatype/nexus
Using default tag: latest
Trying to pull repository docker.io/sonatype/nexus ... 
latest: Pulling from docker.io/sonatype/nexus
af4b0a2388c6: Pull complete 
e2c659f5d884: Pull complete 
37f6e458506e: Pull complete 
b8ce98aa6771: Pull complete 
90969e21cd0f: Pull complete 
Digest: sha256:90f8ec0dadf5fef6bab1269a96f4e71583dadb366dde3cc664c599da5e1421e7
[root@localhost ~]# docker run -d -p 8081:8081 --name nexus docker.io/sonatype/nexus
5f23e18df895901f33a7abf01870984a65257f977e27266d6d319706b6e06719

在docker容器中加载Nexus镜像

  创建Nexus数据文件的挂载目录并授予访问权限:

mkdir /home/nexus && chown -R 200 /home/nexus

  通过Nexus镜像创建Nexus容器并运行指令如下:

docker run -d -p 8081:8081 --name nexus  --restart always -v /home/nexus3:/nexus-data  docker.io/sonatype/nexus

  运行结果:

[root@localhost ~]# docker run -d -p 8081:8081 --name nexus docker.io/sonatype/nexus
5f23e18df895901f33a7abf01870984a65257f977e27266d6d319706b6e06719

  在Nexus运行时,这可能需要等待一段很短的时间,我们可以通过查看Nexus的日志来了解Nexus的运行情况,其指令如下:


                
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值