1

how do i get dockerfile to return a specific exit code from my program? I have a python program and would like to return a code of 2 under certain conditions.

Simply using return 2 does not work.

Any suggestions?

2 Answers2

0

If you want to receive exit code from your program that runs in container you could use docker inspect command:

docker inspect --format='{{.State.ExitCode}}' $INSTANCE_ID
peter
  • 583
  • 2
  • 11
0

Return(2) vs sys.exit(2) is the issue.

The issue was uncovered in this post.

Exit codes in Python