+-

只是想知道是否有更好的方法来跳过可能失败的命令(因为我正在使用jenkins来构建和部署应用程序)
现在我正在做这样的事情
RUN unlink /run/supervisor.sock && etc/init.d/supervisor stop || echo "supervisor was not started"
最佳答案
这是确保零退出代码的典型Linux技巧
RUN unlink /run/supervisor.sock && etc/init.d/supervisor stop || :
这里给出的答案基本上使用不同的语法来实现相同的目的
Dockerfile build – possible to ignore error?
目前没有其他方法可以防止构建失败
点击查看更多相关文章
转载注明原文:在构建期间跳过dockerfile中的错误 - 乐贴网