What to do when I get BuildJobOutOfMemory?

Posted March 26, 2021 860 views
DeploymentDigitalOcean App Platform

Using Dockerfile with DO App platform, we sometimes get BuildJobOutOfMemory.
We tried switching from basic to professional for each component, but that didn’t solve it.

How do I add more ram to the build process?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Hello @amocsy,

The error indicates that you are running out of memory and should consider using a larger instance size for your App.

Here’s the documentation link on error codes:

Let me know how it goes.

  • “The error indicates that you are running out of memory ”
    I figured as much.

    I found the documentation you linked, and it has this to say:

    “Your deploy failed because your container was out of memory.”

    This does answer the question:

    “ should consider using a larger instance size for your App”

    That said, I’m still curious if I could use a large instance for building the image and a smaller one for the running container.

  • I scaled to the largest instance size but I still had the same error.

  • Hi Bobby,

    Can we please get an update on this one? As scaling up to any larger one did not solve the issue.

    Thanks in advance.
    Kind Regards
    Laszlo Nagy (colleague of amocsy)

    • Hi there @nlaszlouk,

      Do you know on average how much memory is used to build the project locally on your local dev environments? If you’ve tried increasing the size of the component to a larger one and it still does not work, I could suggest reaching out to the DigitalOcean support team so that they could look into this for you further:

      Let me know how it goes!
      - Bobby.

      • Dear Bobby,

        Our Project builds smooth on 2gb ram in local environment. Here on DO we struggle with even 4gb.. We have 2 apps with 3 components in each. The ones that needs memory got 4gb the one that does not need got 1gb. Those on 4gb fails many times still…Even after a lot of refactor..
        This is a big problem and takes a huge amount of time to finally see the failed result at the end. This def needs some fix. Please suggest what to do other then - sorry to say - but wasting more money for no reason.

        Thanks a lot
        Laszlo Nagy

        • Hi Laszlo,

          One thing that I could suggest is to deploy from a Docker image instead. That way you will skip the build step and go straight to the deploy so that you would not have to upgrade to a larger instance.

          Let me know how it goes.

      • Hi Bobby,

        One extra note, the 3 component / app is sourced from the same branch from gitlab. Apps are separated at build time, but the 3 build runs more or less at the same time once we push to that 1 branch.