6

Just wonder if theres a better way to skip a command that could fail (because I'm using jenkins to build and deploy the application)

Now I'm doing something like this

RUN unlink /run/supervisor.sock && etc/init.d/supervisor stop || echo "supervisor was not started"
Scott Stensland
  • 26,870
  • 12
  • 93
  • 104
Ali SAID OMAR
  • 6,404
  • 8
  • 39
  • 56

1 Answers1

9

this is a typical linux trick to ensure a zero exit code

RUN unlink /run/supervisor.sock && etc/init.d/supervisor stop || :

the answer given here essentially uses different syntax to achieve the same

Dockerfile build - possible to ignore error?

there is no other way of preventing build failure at present

Community
  • 1
  • 1
danday74
  • 52,471
  • 49
  • 232
  • 283