Nagri
Nagri

Reputation: 3136

Run a command with guaranteed exit code 0 in Dockerfile

I have a dockerfile in which I need to run a test by executing a command say long_testing_commad

Dockerfile

FROM awesome:image
RUN abc
RUN long_testing_commad
RUN xyz

long_testing_commad sometimes fail, and that causes docker build to fail saying "got a non-zero exit status from long_testing_commad".

What can I do in my Dockerfile so that no matter what happens with long_testing_commad the build process goes on.

Upvotes: 0

Views: 519

Answers (1)

bellackn
bellackn

Reputation: 2174

This is probably not best practice, but the easiest way would be:

RUN long_testing_commad || true

Upvotes: 1

Related Questions