Public Repository

Last pushed: 15 days ago
Short Description
Sonatype Nexus Repository Manager 3
Full Description


A Dockerfile for Sonatype Nexus Repository Manager 3, based on CentOS. The git repo is

To run, binding the exposed port 8081 to the host.

$ docker run -d -p 8081:8081 --name nexus sonatype/nexus3

To test:

$ curl -u admin:admin123 http://localhost:8081/service/metrics/ping

To (re)build the image, copy the Dockerfile and do the build:

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


  • Default credentials are: admin / admin123

  • It can take some time (2-3 minutes) for the service to launch in a new container. You can tail the log to determine once Nexus is ready: $ docker logs -f nexus

  • Installation of Nexus is to /opt/sonatype/nexus.

  • A persistent directory, /nexus-data, is used for configuration, logs, and storage. This directory needs to be writable by the Nexus process, which runs as UID 200.

  • Three environment variables can be used to control the JVM arguments

    • JAVA_MAX_HEAP, passed as -Xmx. Defaults to 1200m.

    • JAVA_MIN_HEAP, passed as -Xms. Defaults to 1200m.

    • EXTRA_JAVA_OPTS. Additional options can be passed to the JVM via this variable.

    These can be used supplied at runtime to control the JVM:

    $ docker run -d -p 8081:8081 --name nexus -e JAVA_MAX_HEAP=1500m sonatype/nexus3

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 created specifically for this purpose. This is the recommended approach.
    $ docker run -d --name nexus-data sonatype/nexus3 echo "data-only container for Nexus"
    $ docker run -d -p 8081:8081 --name nexus --volumes-from nexus-data sonatype/nexus3
  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 specific 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:/nexus-data sonatype/nexus3
Docker Pull Command

Comments (24)
8 days ago

Hi! If I need install bundle, What should I do?

8 days ago

"Three environment variables can be used to control the JVM arguments

  • JAVA_MAX_HEAP, passed as -Xmx. Defaults to 1200m.
  • JAVA_MIN_HEAP, passed as -Xms. Defaults to 1200m.
  • EXTRA_JAVA_OPTS. Additional options can be passed to the JVM via this variable."

Is this still valid ? For me JAVA_MIN_HEAP and JAVA_MAX_HEAP didn't work as expected.

Here is a different description:

8 months ago


According to your official docs, upgrade from "3.0.2" to "3.1" must take care manually of many little things (, while on another doc you say with docker you just have to upgrade the image ( Second one is of course wrong. But handling data within docker container is not that easy, especially since Nexus3 stops during the process thus the container is not accessible anymore...
Do you guys have any good solution to migrate from 3.0.2 to a newer version of Nexus (say 3.2 since it has recently been released...)

9 months ago

The "Persistent Data" section is completely bogus. First off, this container doesn't even start if we mount an external volume to /nexus-data. Clearent solved part of this ( but really, it should be sonatype to fix it. Thanks Clearent/@cavemandaveman! Stateless containers FTW!

Besides, there are different kinds of persistent data and there is also non-persistent data! Lock files, pid files, port files and (to some extent) temporary files are not supposed to be persisted! If the service dies suddenly and docker restarts it, we're in trouble if the pid files and lock files from the previous run are still in place because they will prevent the services from starting back up. So they must not be in /nexus-data. Moreover, temporary files and cache files can be saved between container rebuilds/recreates/restarts if that'll save runtime rebuilding cache and whatnot, but that is not the same kind of persistence as the user/permissions database and system configuration files. Temp/cache may be persisted, but there's no point in backing them up. Databases, configurations, user files must be persisted and backed up for disaster recovery.

So all in all, the data in /nexus-data has to be separated in what must be persisted for backup, what may be saved between runs and what must not be kept between runs. These sonatype containers are pretty messed up before that happens.

a year ago

Had some problems upgrading an instance from 3.0.0 to 3.0.2. When I updated the image in the docker-compose.yml file I was using and restarted, I got a whole bunch of "Could not find artifact" errors.

The solution (from here) was to find the volume I was storing the persistent data in (using "docker volume ls" and "docker volume inspect") and then touching a "clean_cache" file in the volume. I could then start the container successfully.

a year ago

@parana I have seen this on first run, but this error is no longer present on subsequent runs.

Considering that Sonatype has not responed to a lot of the issues and suggestions, I created a nexus container you can find here: that is built on top of Alpine, uses OpenJDK, supports SSL, does not require prerequisites on the host for volume mounting, has working JVM args, and uses the latest nexus 3.0.1-01 release

a year ago

I cannot upload files into the repository using the above method. I go to Repositories, but I do not see the "Artifact tab." What did I do wrong?

There is no evidence that Maven is installed. I tried to get it installed in the Docker container. But when inside, I do not have administrator privileges. How do I create a Nexus 3 & Maven Docker container? Would Maven be required to upload files and actually use Nexus 3?

a year ago

perhaps sonatype could consider my pull request updating this image to using OpenJDK

and i think the other repository (sonatype/docker-nexus3) is more up-to-date because it's linked to a automatic build; maybe this respository can be replaced with that one ?

a year ago

Today I get this error:

2016-09-04 13:57:20,210+0000 WARN  [pool-15-thread-1]  org.apache.karaf.features.internal.service.FeaturesServiceImpl - Can't update cfg file /opt/sonatype/nexus/etc/org.apache.karaf.command.acl.feature.cfg (Permission denied)
    at Method) [na:1.8.0_77]
    at [na:1.8.0_77]
    at<init>( [na:1.8.0_77]
    at<init>( [na:1.8.0_77]
    at [org.apache.karaf.features.core:4.0.4]
    at [org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.FeatureConfigInstaller.updateStorage( [org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs( [org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature( [org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.Deployer.deploy( [org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision( [org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl$ [org.apache.karaf.features.core:4.0.4]
    at [na:1.8.0_77]
    at java.util.concurrent.ThreadPoolExecutor.runWorker( [na:1.8.0_77]
    at java.util.concurrent.ThreadPoolExecutor$ [na:1.8.0_77]
    at [na:1.8.0_77]

Some idea to solve this ?

a year ago

Hi team, could you, please, add ssl support, exposing 8443 port by default?
Is it the best way to do it: