简体   繁体   English

如何调试代码引擎构建错误(Dockerfile 策略)?

[英]How to debug Code Engine build errors (Dockerfile strategy)?

I am using IBM Cloud Code Engine.我正在使用 IBM Cloud Code Engine。 Building the container locally, pushing it to the IBM Container Registry and then creating the Code Engine app from it works.在本地构建容器,将其推送到 IBM Container Registry,然后从中创建 Code Engine 应用程序。 Now, I wanted to build the container image using Code Engine.现在,我想使用代码引擎构建容器映像。 The code is in a public GitHub repository.该代码位于公共 GitHub 存储库中。 I am using the build strategy "Dockerfile" based on this Dockerfile .我正在使用基于此Dockerfile的构建策略“Dockerfile”。

When I submit a build using the console, it fails after a while and I see these lines in the output.当我使用控制台提交构建时,它会在一段时间后失败,并且我在输出中看到这些行。

#13 1.368 Collecting ibm_db>=3.0.2
#13 1.374   Downloading ibm_db-3.1.2.tar.gz (1.1 MB)
#13 1.381      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 234.4 MB/s eta 0:00:00
#13 1.711   Installing build dependencies: started
#13 5.425   Installing build dependencies: finished with status 'done'
#13 5.430   Getting requirements to build wheel: started
#13 6.751   Getting requirements to build wheel: finished with status 'done'
#13 6.752 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/tmp/tmpqm5wa7sq/output.json'

How can I investigate this further?我该如何进一步调查? Could the errors be from different tools creating the container image?错误可能来自创建容器映像的不同工具吗? How would I proceed?我将如何进行?

There are several options on how to approach the issue:关于如何解决这个问题有几种选择:

  • First and most important: Obtain and check the logs for anything suspicious .首先也是最重要的: 获取并检查日志是否有任何可疑之处 The logs are available in the Code Engine browser console for the buildruns, or via command line:日志可在构建运行的代码引擎浏览器控制台中或通过命令行获得:

     ibmcloud ce buildrun logs --name mybuildrun
  • In addition, there is extra information on the buildrun by using either此外,还有关于 buildrun 的额外信息,使用

    ibmcloud ce buildrun get --name mybuildrun

    or或者

    ibmcloud ce buildrun events --name mybuildrun
  • On a new GitHub branch or better locally, modify the Dockerfile and add extra steps to access files of interest or print additional debugging output.在新的 GitHub 分支或更好的本地分支上,修改 Dockerfile 并添加额外的步骤来访问感兴趣的文件或打印额外的调试输出。 The latter could be done be adding || cat /some/log/file后者可以添加|| cat /some/log/file || cat /some/log/file to a failing step. || cat /some/log/file到失败的步骤。

  • Make sure that all requirements and packages that are installed are correct and available.确保安装的所有要求和软件包都正确且可用。

  • Check the dependencies for known issues.检查已知问题的依赖关系。

In the case that lead to my question I needed more debug output to find an issue with a broken software module from my requirements.txt.在导致我的问题的情况下,我需要更多的调试输出来从我的 requirements.txt 中找到与损坏的软件模块有关的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Dockerfile生产/构建/调试/测试环境 - Dockerfile production/build/debug/test environment 如何构建dockerfile - How to build dockerfile 如何通过附加到正在运行的容器(没有 Dockerfile)使用 vs 代码调试 python 代码? - How to debug python code using vs code by attaching to a running container (without Dockerfile)? 如果 dockerfile 的名称不是 Dockerfile,我该如何构建 dockerfile? - How do I build a dockerfile if the name of the dockerfile isn't Dockerfile? 如何在Kitematic中使用Dockerfile构建映像? - How to build an image with Dockerfile in Kitematic? 如何在 Dockerfile 中使用“colcon build”? - How to use "colcon build" in a Dockerfile? 如何使用 R 和 Java 构建 Dockerfile - How to build Dockerfile with R & Java App Engine 柔性环境 - Dockerfile Package 安装跳过映像构建 - App Engine Flexible Environment - Dockerfile Package installs skipped on image build Dockerfile 映像构建:Dockerfile 中的“RUN wget”导致部分文件下载,但构建完成且没有错误 - Dockerfile image build: “RUN wget” inside the Dockerfile results in partial file download, but the build completes with no errors 如何理解运行 Angular 的 Dockerfile 中的错误 - How to understand errors in my Dockerfile running Angular
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM