Sonatype NEXUS

Latest version on dockerhub: sonatype/nexus3

Issues

docker: convert to H2 database

Based on advice Nexus migration for OrientDB to H2 for 3.70.1-02 fails as nexus-db-migrator is version 3.70.1-03 #451:

  • Update docker image to tag: to 3.70.2.
  • Create backup task for OrientDB and run it:
    • Nexus –> create task –> type: Admin - Export databases for backup
      • taskname: backup
      • backup location: /nexus-data/backup
  • shutdown nexus docker compose stop
  • edit default command line to start container without running Nexus:
docker-compose.yml
services:
  nexus3:
    image: sonatype/nexus3:3.70.2
    container_name: nexus3
    command: "sleep 3600"
  • Start container docker compose up -d
  • Login into container: docker-compose exec nexus3 /bin/bash
  • cd /nexus-data/backup
  • Check if four backup files exists in nexus-data/backup. Mine was created under subfolder name / (slash) ???. So I moved it to correct location.
  • java -Xmx2G -Xms2G -XX:+UseG1GC -XX:MaxDirectMemorySize=28672M -jar nexus-db-migrator-3.70.1-03.jar –migration_type=h2
  • cp nexus.mv.db /nexus-data/db
  • vi /nexus-data/etc/nexus.properties and add/change: nexus.datastore.enabled=true and save.
  • exit from container (CTRL+D)
  • stop container docker compose stop
  • remove command from docker-compose.yml
  • run again Nexus 3.70.2: docker compose up -d
  • check if H2 database is used: docker compose logs | grep H2
  • stop, update Nexus to 3.71.0 and start

unknown blob

Gitlab Runner cannot get docker image:

ERROR: Preparation failed: failed to pull image “…” with specified policies [always]: unknown blob (manager.go:205:3s)

In nexus log, lot of: org.sonatype.nexus.repository.docker.internal.V2Exception: authentication required

In host dockerd log:

Jul 19 06:53:49 lxc809 dockerd[303]: time="2021-07-19T06:53:49.863528790Z" level=error msg="Download failed after 1 attempts: unknown blob"
Jul 19 06:53:49 lxc809 dockerd[303]: time="2021-07-19T06:53:49.863896588Z" level=error msg="Download failed after 1 attempts: unknown blob"
Jul 19 06:53:50 lxc809 dockerd[303]: time="2021-07-19T06:53:50.724398387Z" level=error msg="Download failed after 1 attempts: unknown blob"
Jul 19 06:53:50 lxc809 dockerd[303]: time="2021-07-19T06:53:50.724503196Z" level=info msg="Attempting next endpoint for pull after error: unknown blob"

Reason: Due to bug Docker - Delete unused manifests and images task may delete referenced layers if the database query to select components encounters limits, docker blobs were removed.

Solution: redeploy image again.