Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Skip error in dockerfile during the build

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"
like image 609
Ali SAID OMAR Avatar asked Apr 01 '16 14:04

Ali SAID OMAR


1 Answers

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

like image 106
danday74 Avatar answered Oct 10 '22 04:10

danday74