Docker buildx禁用乘数的并行构建

发布于 2025-01-19 20:56:17 字数 573 浏览 5 评论 0原文

我有一个docker构建,在构建过程中需要运行服务器以进行某些管理配置。通过运行服务器,它声称端口并在多平台构建期间与docker buildx命令发生冲突,因为它声称端口已经在使用。

现在,我想依次运行构建,而不是并行运行,但这似乎不是一个选择吗?

我试图通过将CPU设置为1(-CPUSET-CPUS 1)来进行这项工作,但这似乎并没有区别。

docker buildx build --platform=linux/amd64,linux/arm64/v8 --cpuset-cpus 1 --push -t ivonet/payara .

,那么是否可以通过禁用并行运行此构建?

I have a docker build that during the build needs to run the server for some admin configuration. By running the server it claims a port and during multi-platform build this conflicts with the docker buildx command as it claims that the port is already in use.

Now I would like to run the build sequentially instead of in parallel but that does not seem to be an option?

I've tried to make this work by setting the cpus to 1 (--cpuset-cpus 1) but that does not seem to make a difference.

docker buildx build --platform=linux/amd64,linux/arm64/v8 --cpuset-cpus 1 --push -t ivonet/payara .

So is it possible to run this build with parallel disabled?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

止于盛夏 2025-01-26 20:56:17

我现在已经对此进行了一些研究,但我还没有找到令人满意的答案,除了目前似乎不可能禁用并行性。

我确实找到了一个对我有用的解决方法,并且在这个问题上很好地走了。
现在,我使用实际的远程服务器来构建所需的目标平台。

从本质上讲,一个人在其上安装了Docker,定义了遥控器(通过SSH)服务器,然后将其配置为构建特定目标。
这样,它实际上可以并行运行,因为物理上不同的机器可以处理正式重叠的端口号(就像我用例中的问题一样)。

阅读有关它的完整博客文章在这里

I've done a bit of research on it now and I have not found a satisfactory answer other than that it does not seem to be possible at this time to disable the parallelism.

I did find a workaround that works for me and steps nicely around this issue.
I now use actual remote servers to build the target platforms I need.

In essence, one defines a remote (through ssh) server with docker installed on it and you configure it to build specific targets.
That way it can actually run in parallel as the physically different machines can handle the formally overlapping port number (as was the problem in my use case).

Read the full blog post on it here

千秋岁 2025-01-26 20:56:17

创建构建器时,您可以传递此信息:

buildkitd.toml

[worker.oci]
  max-parallelism = 1

在本地计算机上时:

docker buildx create --use \
  --name mybuilder \
  --driver docker-container \
  --config <<dir>>/buildkitd.toml

当您在GitHub操作上时:

    - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
        with:
          platforms: linux/amd64,linux/arm64
          config: <<dir>>/buildkitd.toml

when you create a builder, you can pass this info:

buildkitd.toml

[worker.oci]
  max-parallelism = 1

when you are on local machine:

docker buildx create --use \
  --name mybuilder \
  --driver docker-container \
  --config <<dir>>/buildkitd.toml

when you are on github actions:

    - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
        with:
          platforms: linux/amd64,linux/arm64
          config: <<dir>>/buildkitd.toml
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文