sonatype / nexus-public

Sonatype Nexus Repository Open-source codebase mirror
https://www.sonatype.com/products/repository-oss-download
Eclipse Public License 1.0
1.84k stars 557 forks source link

Upgrade Nexus 3.6x.y to latest using docker-compose failed #337

Open bharathjakkani opened 4 months ago

bharathjakkani commented 4 months ago

I am upgrading the nexus3 docker repo container. My goal is to upgrade from 3.60.0 to the 3.64 image. Current Running container

$ docker ps
CONTAINER ID   IMAGE                    COMMAND                  CREATED              STATUS              PORTS                                       NAMES
b79036d9da83   sonatype/nexus3:3.60.0   "/opt/sonatype/nexus…"   About a minute ago   Up About a minute   0.0.0.0:8081->8081/tcp, :::8081->8081/tcp   nexus

$ docker-compose images
CONTAINER           REPOSITORY          TAG                 IMAGE ID            SIZE
nexus           sonatype/nexus3     3.60.0              0b14bd3acc13        552MB

After changing the docker image to the 3.64 as below in the docker-compose file. I have recreated the container

version: "3.9"
services:
  nexus:
    # image: sonatype/nexus3:3.60.0
    image: sonatype/nexus3:3.64.0
    container_name: nexus
    ports:
      - 8081:8081
    restart: always
    volumes:
      - "/data/nexus/:/nexus-data"
      - nexus-vol:/opt/sonatype
volumes:
    nexus-vol:
$ docker-compose down
[+] Running 2/2
 ✔ Container nexus   Removed                              10.4s
 ✔ Network demo_default  Removed                    0.3s

$ docker-compose pull nexus
[+] Pulling 8/8
 ✔ nexus 7 layers [⣿⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                                                                                        102.9s
   ✔ 736dd843e4bf Pull complete                                                                                                                32.3s
   ✔ edea3adfce2f Pull complete                                                                                                                63.3s
   ✔ 12e0045f8deb Pull complete                                                                                                                 0.9s
   ✔ 5982dd44b987 Pull complete                                                                                                                94.2s
   ✔ 2d9ed93e480f Pull complete                                                                                                                33.5s
   ✔ 3de9fe011680 Pull complete                                                                                                                35.0s
   ✔ e3858902e106 Pull complete                                                                                                                38.7s

[demo@rhel8 ~]$ docker image ls
REPOSITORY        TAG       IMAGE ID       CREATED        SIZE
sonatype/nexus3   3.64.0    bda195cc2883   3 weeks ago    572MB
sonatype/nexus3   3.60.0    0b14bd3acc13   5 months ago   552MB

$ docker-compose up -d nexus
[+] Running 1/2
 ⠸ Network demo_default  Created                         1.3s
 ✔ Container nexus   Started                                   0.8s

Now, the docker is saying the container is using the new image (3.64) but it is still showing 3.60 in the web browser.

$ docker ps
CONTAINER ID   IMAGE                    COMMAND                  CREATED         STATUS         PORTS                                       NAMES
513e26fb21d2   sonatype/nexus3:3.64.0   "/opt/sonatype/nexus…"   6 seconds ago   Up 5 seconds   0.0.0.0:8081->8081/tcp, :::8081->8081/tcp   nexus

$ docker-compose images
CONTAINER           REPOSITORY          TAG                 IMAGE ID            SIZE
nexus           sonatype/nexus3     3.64.0              bda195cc2883        572MB

$ $ curl --include --silent http://localhost:8081 | grep Server
Server: Nexus/3.60.0-02 (OSS)

I am not sure what else needs to be done. I am using the persistent volume for /opt/sonatype and this directory has the jar files. I don't know if I have to do anything in there.

Please help! Thank you,

nblair commented 4 months ago

This is a scenario where we would need a support ticket (through a pro subscription) in order to help you diagnose the issue further. I've tagged it as help-wanted to see if the community can help.

What happens if you insert your test curl command against localhost:8081 after running docker-compose down? Perhaps you aren't stopping/starting the instance you think you are?

bharathjakkani commented 4 months ago

Thanks for tagging. curl returns nothing once I do the docker-compose down and an exit code of 1 is returned, means the website is unreachable.

bharathjakkani commented 4 months ago

I had to avoid using persistent volume for the whole /opt/sonatype instead of that, I should only map volumes for /opt/sonatype/etc/jetty and /opt/sonatype/etc/ssl. So, the jar files directories are overwritten by the new image and the new Nexus OSS version appears on the web interface.

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 60 days with no activity.