Docker学习之搭建maven私有仓库

实战环境:centos7

启动maven私有仓库的容器

  1. 在docker所在服务器创建目录/usr/local/dockermaven
  2. 执行命令chmod 777 /usr/local/dockermaven,给此目录赋权限;
  3. 执行以下命令,会自动从hub.docker.com下载最新的nexus镜像,然后启动一个名为nexus的容器,当前电脑的8081端口被映射到容器的8081端口: 
    docker run -idt -p 8081:8081 --name nexus -v /usr/local/dockermaven:/sonatype-work sonatype/nexus3 

本次实战要用到的端口是8081,如果该端口已被占用请及时释放。

执行命令docker logs -f nexus查看容器日志滚动信息,显示如下信息时nexus启动成功:

2018-05-21 06:52:38,930+0000 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.siesta.SiestaServlet - Initialized
2018-05-21 06:52:39,086+0000 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Initialized
2018-05-21 06:52:40,861+0000 INFO  [jetty-main-1] *SYSTEM org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.w.WebAppContext@36a1ae3e{/,file:///opt/sonatype/nexus/public/,AVAILABLE}
2018-05-21 06:52:43,731+0000 INFO  [jetty-main-1] *SYSTEM org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@33bd2e94{HTTP/1.1,[http/1.1]}{0.0.0.0:8081}
2018-05-21 06:52:43,996+0000 INFO  [jetty-main-1] *SYSTEM org.eclipse.jetty.server.Server - Started @521458ms
2018-05-21 06:52:44,126+0000 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - 
-------------------------------------------------
Started Sonatype Nexus OSS 3.11.0-01
-------------------------------------------------
2018-05-21 07:00:00,231+0000 INFO  [quartz-5-thread-1] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] state change WAITING -> RUNNING
2018-05-21 07:00:00,772+0000 INFO  [quartz-5-thread-1] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] state change RUNNING -> WAITING (OK)

因此在浏览器输入地址访问nexus:http://192.168.5.144:8081

账号密码:admin/admin123

Docker学习之搭建maven私有仓库_第1张图片

你可能感兴趣的:(docker)