搜索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
的