scott4
Mission Specialist
Mission Specialist
  • 1,318 Views

DO180 Comprehensive Review - Container exiting immediately

Jump to solution

I've tried for about 3 days to get past this. I tried my Dockerfile and the solution's Dockerfile. The container builds, I ran the script to get the nexus files, and when I run the run-persistent.sh the container exist immediately.

Running podman logs only shows this:

nexus-start.sh: line 8: cd: /opt/nexus/nexus2: No such file or directory
Error: Could not find or load main class org.sonatype.nexus.bootstrap.Launcher

Any ideas? I reviewed the persistence section and everything seems right.

1 Solution

Accepted Solutions
jordisola
Flight Engineer
Flight Engineer
  • 1,098 Views

Re: DO180 Comprehensive Review - Container exiting immediately

Jump to solution

Hi

I should have been more explicit. You are right, I meant the `curl` command inside the `get_nexus_bundle.sh` script. I should be something like: 

> curl -L --progress-bar -O https://download.sonatype.com/nexus/oss/nexus-2.14.3-02-bundle.tar.gz

Note the "-L" parameter, indicating the curl command to follow redirects.

It really sounds like the script is silently failing, and the tarball is not being downloaded (IIRC, a HTML page is downloaded instead). This does not block creating the container image, but causes the later run issue.

P.S. Building the image using the --no-cache parameter is not necessary. If local files are changed, the layer including those files will also change, hence the cache will not hit.

View solution in original post

Reply
Loading...
9 Replies
scott4
Mission Specialist
Mission Specialist
  • 1,309 Views

Re: DO180 Comprehensive Review - Container exiting immediately

Jump to solution

I had to change the curl in get-nexus-bundle to follow redirects. It was downloading the tar as an html file, and that broke the next steps. Maybe I screwed something up, not sure.

0 Kudos
Reply
Loading...
  • 1,148 Views

Re: DO180 Comprehensive Review - Container exiting immediately

Jump to solution

Hi
I am facing the same issue and tried with solutions as well, no luck.
Stuck at the same step.
Any help would be appreciated.
Thanks

0 Kudos
Reply
Loading...
jordisola
Flight Engineer
Flight Engineer
  • 1,133 Views

Re: DO180 Comprehensive Review - Container exiting immediately

Jump to solution

Hi everyone

I just tried to replicate the issue but it worked fine on my side.

What versions of the course are you using? Can you provide the output of the `curl` command?

KR

 

Jordi Sola

0 Kudos
Reply
Loading...
scott4
Mission Specialist
Mission Specialist
  • 1,126 Views

Re: DO180 Comprehensive Review - Container exiting immediately

Jump to solution

Like I described, the video instructs to get that nexus tarball, but if I recall, the url was correct, but there was a redirect on the server side to a CDN or something so the curl failed. I didn't throw an error until later in the process. 

OP: Make sure that you have the right nexus files and that they extract and install, as expected. As soon as I could get a tarball from curl, I think that fixed it. 

TL;DR: I think I just had to add -L to my curl.

0 Kudos
Reply
Loading...
  • 1,123 Views

Re: DO180 Comprehensive Review - Container exiting immediately

Jump to solution

Hi
I can't run the curl as the pod is getting exited after running ./run-persistent.sh.

I tried running ./run-persistent.sh after re-building the nexus images. Will that be a problem ?

Snippet of the steps performed.

  1. [student@workstation image]$ ./get-nexus-bundle.sh
  2. ######################################################################## 100.0%
  3. Nexus bundle download successful
  4.  
  5. [student@workstation image]$ sudo podman build -t nexus .
  6. STEP 1: FROM ubi7/ubi:7.7
  7. --> Using cache b3110dfff0ed735f2b6dd2fff6815a3a7c040cd8a7db4b800c94499abb393174
  8. STEP 23: COMMIT nexus
  9. [student@workstation image]$
  10. /home/student/DO180/labs/comprehensive-review/image
  11. [student@workstation image]$ cd ../deploy/local/
  12. [student@workstation local]$ ./run-persistent.sh
  13. 37bab4a1053d8f091335daca184fe6f0894109dd57656182733726226b4b3f21
  14.  
  15. [student@workstation local]$ sudo podman ps -a
  16. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES IS INFRA
  17. 37bab4a1053d localhost/nexus:latest sh nexus-start.sh 11 seconds ago Exited (1) 10 seconds ago vibrant_hermann false
  18. [student@workstation local]$
  19. [student@workstation local]$ sudo podman logs vibrant_hermann
  20. nexus-start.sh: line 8: cd: /opt/nexus/nexus2: No such file or directory
  21. Error: Could not find or load main class org.sonatype.nexus.bootstrap.Launcher
    ##

0 Kudos
Reply
Loading...
scott4
Mission Specialist
Mission Specialist
  • 1,121 Views

Re: DO180 Comprehensive Review - Container exiting immediately

Jump to solution

I think the curl might be in that ./get-nexus-bundle.sh maybe?

0 Kudos
Reply
Loading...
scott4
Mission Specialist
Mission Specialist
  • 1,118 Views

Re: DO180 Comprehensive Review - Container exiting immediately

Jump to solution

Oh, and I think you may want to build the container from scratch with --no-cache, maybe?

0 Kudos
Reply
Loading...
jordisola
Flight Engineer
Flight Engineer
  • 1,099 Views

Re: DO180 Comprehensive Review - Container exiting immediately

Jump to solution

Hi

I should have been more explicit. You are right, I meant the `curl` command inside the `get_nexus_bundle.sh` script. I should be something like: 

> curl -L --progress-bar -O https://download.sonatype.com/nexus/oss/nexus-2.14.3-02-bundle.tar.gz

Note the "-L" parameter, indicating the curl command to follow redirects.

It really sounds like the script is silently failing, and the tarball is not being downloaded (IIRC, a HTML page is downloaded instead). This does not block creating the container image, but causes the later run issue.

P.S. Building the image using the --no-cache parameter is not necessary. If local files are changed, the layer including those files will also change, hence the cache will not hit.

View solution in original post

Reply
Loading...
KevinRoche
Cadet
Cadet
  • 255 Views

Re: DO180 Comprehensive Review - Container exiting immediately

Jump to solution

My container kept failing to stay up and running as well, but if I ran it as interactive and ran the nexus-start.sh script from there, it worked.

I finally figured out there was an error in the CMD line in the Dockerfile.
Changing it from

CMD ["sh", "start-nexus.sh"]

to 
CMD ["/bin/sh","nexus-start.sh"]

solved the problem.

Reply
Loading...
Join the discussion
You must log in to join this conversation.