Maven

docker镜像:sonatype/docker-nexus

2019-01-15  本文已影响172人  夜游上河园

Docker images for Sonatype Nexus Repository Manager 2 with the Oracle JDK. For Nexus Repository Manager 3, please refer to https://github.com/sonatype/docker-nexus3

To build:

# docker build --rm --tag sonatype/nexus oss/
# docker build --rm --tag sonatype/nexus:pro pro/

To run (if port 8081 is open on your host):

# docker run -d -p 8081:8081 --name nexus sonatype/nexus:oss

To determine the port that the container is listening on:

# docker ps -l

To test:

$ curl http://localhost:8081/nexus/service/local/status

To build, copy the Dockerfile and do the build:

$ docker build --rm=true --tag=sonatype/nexus .

Notes

$ docker logs -f nexus

Persistent Data

There are two general approaches to handling persistent storage requirements with Docker. See Managing Data in Containers for additional information.

  1. Use a data volume container. Since data volumes are persistent until no containers use them, a container can be created specifically for this purpose. This is the recommended approach.

    $ docker run -d --name nexus-data sonatype/nexus echo "data-only container for Nexus"
    $ docker run -d -p 8081:8081 --name nexus --volumes-from nexus-data sonatype/nexus
    
    
  2. Mount a host directory as the volume. This is not portable, as it relies on the directory existing with correct permissions on the host. However it can be useful in certain situations where this volume needs to be assigned to certain underlying storage.

    $ mkdir /some/dir/nexus-data && chown -R 200 /some/dir/nexus-data
    $ docker run -d -p 8081:8081 --name nexus -v /some/dir/nexus-data:/sonatype-work sonatype/nexus
    
    

Adding Nexus Plugins

Creating a docker image based on sonatype/nexus is the suggested process: plugins should be expanded to /opt/sonatype/nexus/nexus/WEB-INF/plugin-repository. See https://github.com/sonatype/docker-nexus/issues/9 for an example concerning the Nexus P2 plugins.

Getting Help

Looking to contribute to our Docker image but need some help? There's a few ways to get information or our attention:

上一篇 下一篇

猜你喜欢

热点阅读