Setting a Failure Exit Code in a Docker Container

Set a failure exit code in a Docker container when the workflow fails.

When the workflow failed to get the vault password, the build returned a green checkmark. It did not accurately return the Ansible failure. Without an accurate build status, you won’t know what or when to troubleshoot.

You fix this issue by setting failure exit codes in the Docker container. There are many ways to go about it, but a simple solution is to add an if statement to the entrypoint.sh.

Review the if statement below:

Get hands-on with 1200+ tech skills courses.