只是想知道是否有更好的方法来跳过可能失败的命令(因为我正在使用jenkins来构建和部署应用程序)
现在我正在做这样的事情
RUN unlink /run/supervisor.sock && etc/init.d/supervisor stop || echo "supervisor was not started"
答案 0 :(得分:5)
这是确保零退出代码的典型linux技巧
RUN unlink /run/supervisor.sock && etc/init.d/supervisor stop || :
这里给出的答案基本上使用不同的语法来实现相同的
Dockerfile build - possible to ignore error?
目前没有其他方法可以防止构建失败