Skip error in dockerfile during the build

Ali SAID OMAR picture Ali SAID OMAR · Apr 1, 2016 · Viewed 8.1k times · Source

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"

Answer

danday74 picture danday74 · Apr 1, 2016

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