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

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

问题描述

我有一个 Dockerfile.构建映像时,构建失败并出现此错误:

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

这实际上是无害的.该库构建良好,但 Docker 一旦收到此错误就会停止构建.有什么办法可以指示 Docker 忽略这个吗?

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?

推荐答案

好的.Docker 只是响应 Dockerfile 中的 RUN shell 脚本返回的错误代码.如果你的 Dockerfile 有类似的东西:

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

您可以将其替换为:

RUN make; exit 0

这将始终返回 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天全站免登陆