#13255·portainer

Git-based stack deployment with `build:` fails via Portainer Agent, succeeds via local Docker socket

Author: farewarrCreated Aug 2, 2026Updated Sep 27, 2026
Labelskind/bugbug/need-confirmationbot/triage-completerelease/3.0.0

Before you start please confirm the following.

  • Yes, I've searched similar issues on GitHub.
  • Yes, I've checked whether this issue is covered in the Portainer documentation.

Problem Description

Summary

Deploying a Git-managed Compose stack that contains a build: directive fails when the target environment is connected via Portainer Agent, but the identical stack, from the identical repository and commit, deploys successfully when the target environment is the local Docker socket environment on the Portainer host itself.

The failure occurs during BuildKit worker discovery. BuildKit on the agent-managed host is healthy and builds the same context correctly when invoked directly via the Docker CLI on that host, which narrows the fault to the Agent's proxying of the BuildKit gRPC session rather than to the Docker daemon or to the build context.

Environment

Item Value
Portainer Business Edition 2.43.0 STS
Portainer Agent 2.43.0
Agent endpoint tcp://<host>:9004
Agent host OS Ubuntu (x86_64)
Docker Engine (agent host) 29.6.2, Standalone
Buildx (agent host) v0.35.0
BuildKit (agent host) v0.31.2, default driver, status running
Docker Engine (Portainer host) same major version, local socket environment
Stack source Git repository, GitOps updates enabled
Compose file contains a build: directive with build args

Error message

Deploying the stack to the agent-managed environment fails immediately with:

failed to deploy a stack: compose build operation failed: listing workers for Build:
failed to list workers: Unavailable: connection error: desc = "error reading server
preface: http2: failed reading the frame payload: http2: frame too large, note that
the frame header looked like an HTTP/1.1 header"

The stack's container list remains empty. No container is created.

Steps to reproduce

  1. Add a Docker Standalone environment to Portainer using the Portainer Agent (port 9004).
  2. Create a new stack using Repository as the build method, pointing at any Git repository whose Compose file contains a build: section (rather than only image:).
  3. Deploy the stack to the agent-managed environment.
  4. Observe the deployment failure above.
  5. Create the same stack, from the same repository, ref, and Compose path, targeting the local environment (the Docker socket on the Portainer host).
  6. Observe that the build runs and the stack deploys successfully.

Expected Behavior

Expected behaviour

A Git-managed stack containing a build: directive should build and deploy on an agent-managed environment in the same way it does on a socket-connected environment.

Actual Behavior

Actual behaviour

BuildKit worker enumeration fails during the build phase on agent-managed environments only. The error text indicates that the client expected HTTP/2 frames on the BuildKit gRPC stream but received bytes whose framing resembled an HTTP/1.1 response, which is characteristic of a proxied gRPC session that has not been relayed as a transparent HTTP/2

Steps to Reproduce

Steps to reproduce

  1. Add a Docker Standalone environment to Portainer using the Portainer Agent (port 9004).
  2. Create a new stack using Repository as the build method, pointing at any Git repository whose Compose file contains a build: section (rather than only image:).
  3. Deploy the stack to the agent-managed environment.
  4. Observe the deployment failure above.
  5. Create the same stack, from the same repository, ref, and Compose path, targeting the local environment (the Docker socket on the Portainer host).
  6. Observe that the build runs and the stack deploys successfully.

Portainer logs or screenshots

Image

Evidence that the target host and its BuildKit are healthy

All of the following were run directly on the agent-managed host:

$ docker buildx version
github.com/docker/buildx v0.35.0 a319e5b15052cf6557ceb666eb8ff6e32380b782

$ docker buildx ls
NAME/NODE     DRIVER/ENDPOINT   STATUS    BUILDKIT   PLATFORMS
default*      docker
 \_ default    \_ default       running   v0.31.2    linux/amd64 (+3), linux/386

A direct docker build against the same daemon reaches BuildKit, enumerates workers, and begins solving the build definition without any transport error — confirming the daemon's BuildKit gRPC endpoint responds correctly to a local client.

The environment itself is reported as healthy in Portainer (status Up, all containers enumerated, snapshots current), so general agent connectivity is not affected. Only the

Portainer version

2.43.0

Portainer Edition

Business Edition (BE/EE) with Home & Student license

Platform and Version

Docker 29.6.2

OS and Architecture

Ubuntu 24.04.4 LTS

Browser

Brave & Chrome

What command did you use to deploy Portainer?

bash
services:
    portainer:
        image: portainer/portainer-ee:sts
        container_name: portainer
        networks:
            - apps_network
        dns:
            - 8.8.8.8
            - 8.8.4.4
        ports:
            - 8002:8002
            - 9002:9002
            - 9494:9443
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
            - /home/fareedwarrad/docker/portainer:/data
            - /etc/localtime:/etc/localtime:ro
       # command:
         # -H tcp://host.docker.internal:2375
        cap_add:
          - SYS_ADMIN
        security_opt:
          - "apparmor=unconfined"
        environment:
            - PORTAINER_HTTP_TIMEOUT=3600  # Sets the timeout to 3600 seconds (1 hour)
        restart: always
        pull_policy: always

networks:
    apps_network:
        external: true

Additional Information

Portainer Version Additional Information:

I originally ran this prior to 2.44.0 was released. I have not tested this on 2.44.0 yet however if you can confrim its fixed in 2.44.0, I will test it.

Scope

  • Stacks that only pull images (image:) deploy correctly through the Agent.
  • Stacks that build images (build:) fail through the Agent.
  • The same build-type stack succeeds on a socket-connected environment.

This suggests the regression is confined to how the Agent relays the BuildKit gRPC session, not to Compose parsing, Git checkout, or general Docker API proxying.

Impact

For agent-managed environments, this removes the ability to use Portainer's Git/GitOps integration for any application that is built from source rather than pulled from a registry. Because Portainer does not retain a local Compose working directory on agent-managed endpoints, there is also no supported local workaround: the Compose file cannot be patched in place, and Portainer's own documentation directs users to edit the Compose file in the source repository, which is not possible when the repository is third-party.

The practical workarounds available today are all undesirable:

  • Pre-build the image out of band and rewrite the stack to reference image: — which removes the automatic rebuild that GitOps updates were selected for.
  • Push to a registry and pull from it — additional infrastructure for a single stack.
  • Relocate the stack to a socket-connected environment — not possible when the workload must run on a specific host.

Request

Please treat the BuildKit gRPC stream as an opaque HTTP/2 stream within the Agent's proxying layer so that build:-type Compose stacks deploy on agent-managed environments as they do on socket-connected ones. If transparent relaying is not feasible, an explicit error stating that builds are unsupported on agent-managed endpoints — surfaced at stack creation time rather than as a transport error at deploy time — would at least make the limitation discoverable.