Skip to content

Instantly share code, notes, and snippets.

@stefansundin
Last active January 17, 2024 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefansundin/fa1c1dd7a60ebe2f8a2aa6d32631b119 to your computer and use it in GitHub Desktop.
Save stefansundin/fa1c1dd7a60ebe2f8a2aa6d32631b119 to your computer and use it in GitHub Desktop.
How to limit `docker buildx build` concurrency

If your computer is running out of memory during a docker build, or if the build is CPU intensive, you might want to try building one architecture at a time.

When creating the builder instance, specify a buildkitd config file with --config that limits the concurrency.

Create buildkitd.toml:

[worker.oci]
max-parallelism = 1

And run:

docker buildx create --use --name multiarch-limit --node multiarch-limit0 --config buildkitd.toml

Future builds should hopefully not crash with out of memory errors. :)

Documentation: https://docs.docker.com/build/buildkit/configure/#max-parallelism

[worker.oci]
max-parallelism = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment