Skip to content

harness: dockerfile field in harness.json is silently ignored on deploy (no image is built or pushed) #927

@aryankhanna2004

Description

@aryankhanna2004

Summary

On the preview branch, harness.json validates the dockerfile field (see src/schema/schemas/primitives/harness.ts / src/schema/llm-compacted/agentcore.ts), and agentcore create / agentcore add harness with a template will copy a Dockerfile next to harness.json. However, agentcore deploy does not build or push the Dockerfile, and no error/warning is emitted. The resulting harness is created without any custom container — silently.

This is surprising given the obvious user expectation that setting dockerfile: "Dockerfile" in harness.json would cause the CLI to build/push that image (mirroring the agent Container build path introduced in #783).

Version / Environment

  • @aws/agentcore@1.0.0-preview.1 (installed globally and verified by building and running HEAD of the preview branch locally)
  • macOS 15.3 / Node 20 / Docker available
  • Region: us-east-1

Reproduction

harness.json:

{
  "name": "pptagent",
  "model": { "provider": "bedrock", "modelId": "us.anthropic.claude-opus-4-5-20251101-v1:0" },
  "tools": [
    { "type": "agentcore_browser", "name": "browser" },
    { "type": "agentcore_code_interpreter", "name": "code-interpreter" }
  ],
  "skills": ["/opt/skills/pptx"],
  "dockerfile": "Dockerfile",
  "sessionStoragePath": "/mnt/data",
  "authorizerType": "AWS_IAM"
}

A Dockerfile exists alongside harness.json. Running:

agentcore deploy --yes --verbose

completes successfully, but:

  1. No Docker build or ECR push step runs.
  2. The synthesized CFN template (agentcore/cdk/cdk.out/*.template.json) contains no container image / ECR / asset references for the harness.
  3. The resulting harness has no custom environment artifact.

Root cause (code pointers on preview)

src/cli/operations/deploy/imperative/deployers/harness-mapper.ts only consumes containerUri when building CreateHarness options:

// Container artifact
if (harnessSpec.containerUri) {
  result.environmentArtifact = mapEnvironmentArtifact(harnessSpec.containerUri);
}

The dockerfile field from the validated HarnessSpec is never read by the deployer. src/assets/cdk/bin/cdk.ts does pass hasDockerfile: !!harnessSpec.dockerfile into the CDK stack, but the CDK construct (AgentCoreHarnessRole) only creates an IAM role; there is no DockerImageAsset / CodeBuild step that produces a containerUri for harnesses. As a result, dockerfile is declared-but-unimplemented.

Expected behavior

Either:

  • (A) Implement build+push — When harnessSpec.dockerfile is set and harnessSpec.containerUri is not, build the Dockerfile next to harness.json and push it (via CDK DockerImageAsset or a CodeBuild-backed asset, mirroring the agent Container path), then feed the resulting image URI into mapHarnessSpecToCreateOptions.
  • (B) Minimum bug fix — Until (A) ships, fail fast with a clear, actionable error during agentcore deploy instead of silently ignoring dockerfile.

I'm happy to send a PR for (B) (fail fast + unit test) immediately, and would love guidance on (A) if it's already on the roadmap.

Related

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions