Dockerfile构建 - 可以忽略错误? [英] Dockerfile build - possible to ignore error?

查看:2788
本文介绍了Dockerfile构建 - 可以忽略错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Docker文件。构建映像时,构建失败,出现此错误:

  automake:error:没有为任何配置找到Makefile.am输出
错误构建:命令[/ bin / sh -c aclocal&& autoconf&& automake -a]返回一个非零代码:1

这在现实中是无害的。该库构建良好,但Docker收到此错误后会停止构建。有什么办法可以指导Docker忽略这个吗?

解决方案

当然可以。 Docker只是响应 Dockerfile 中的 RUN shell脚本返回的错误代码。如果您的 Dockerfile 具有以下内容:

  RUN make 

您可以将其替换为:

 code> RUN make;退出0 

这将始终返回一个 0 (成功)退出代码。这里的缺点是,即使在构建过程中 实际的错误,您的图像也将显示为成功。


I've got a Dockerfile. When building the image, the build fails on this error:

automake: error: no 'Makefile.am' found for any configure output
Error build: The command [/bin/sh -c aclocal && autoconf && automake -a] returned a non-zero code: 1

which in reality is harmless. The library builds fine, but Docker stops the build once it receives this error. Is there any way I can instruct Docker to just ignore this?

解决方案

Sure. Docker is just responding to the error codes returned by the RUN shell scripts in the Dockerfile. If your Dockerfile has something like:

RUN make

You could replace that with:

RUN make; exit 0

This will always return a 0 (success) exit code. The disadvantage here is that your image will appear to build successfully even if there are actual errors in the build process.

这篇关于Dockerfile构建 - 可以忽略错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆