gpt4 book ai didi

docker - 在构建期间跳过 dockerfile 中的错误

转载 作者:行者123 更新时间:2023-12-05 00:56:19 24 4
gpt4 key购买 nike

只是想知道是否有更好的方法来跳过可能失败的命令(因为我正在使用 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?

目前没有其他方法可以防止构建失败

关于docker - 在构建期间跳过 dockerfile 中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36358749/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com