0

I am using docker command line to execute a java application. My java application returns different exit based based on execution result.

e.g in case of error, my java program exits with 101 In case of success, my java program exits with 0

When I run this application from eclipse, I can see that application exit with code as specified above.

However when I run the same application from docker then I am always getting exit code as 127 in case my program errors. For success scenario, the docker command correctly shows the exit code as 0 (zero)

I googled but could not find a answer. Can anybody tell me why it might be happening and any fix for this.

Below are the details: My docker command:

dzdo docker run myapp:28 java -jar myapp.jar

I use below command to check the exit status code:

echo $?

Thanks,

1
  • Does the exit code change if you run without dzdo? Commented Feb 22, 2018 at 15:47

1 Answer 1

1

The exit status of docker is the exit status of the command, or a code 125 or higher to indicate that something went wrong in docker, the command couldn't be invoked, or the command terminated because of a signal.

See: https://docs.docker.com/engine/reference/run/#exit-status

Exit code 127 indicates that the command could not be found by docker. If you're sure that your command can be found, then by exclusion we can arrive at one other option:

The dzdo command is changing your exit code.

Unfortunately, I can find documentation on dzdo that describes what exit codes it uses.

Try running docker without dzdo (become the target user first, if possible) to see if it gives the correct exit code without dzdo - or run a script with dzdo that a) runs docker and b) prints the exit code

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.