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

229 Views Asked by At

I am using 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. Now, I wanted to build the container image using Code Engine. The code is in a public GitHub repository. I am using the build strategy "Dockerfile" based on this 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?

1

There are 1 best solutions below

0
data_henrik On BEST ANSWER

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

    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. The latter could be done be adding || cat /some/log/file to a failing step.

  • 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.