Skip to content

[Bug]: Service deploy fails, TaskDefinition Container.image is null when using image.build #6070

@mrloldev

Description

@mrloldev

Description

Deploying a new Load Balanced Web Service with Copilot v1.34 fails during CloudFormation with:

Invalid request provided: Create TaskDefinition: Container.image repository should not be null or empty.

Copilot appears to generate a task definition with an empty image field. Building and pushing the image by hand and specifying image.location in the manifest works, so the error seems to come from Copilot’s build/push logic.

Setup

  • Copilot CLI version: v1.34.1
  • OS: macOS on Apple silicon
  • Docker engine: OrbStack
  • Region: us‑east‑1
  • Service type: Load Balanced Web Service
  • The manifest uses an image.build section with a Dockerfile and build arg for a private Python package index.

Observed result

Running copilot svc deploy --name <service> --env staging results in a rollback. ECS task definition creation fails with the error above. When I inspect the CloudFormation template produced by copilot svc package, the ContainerImage parameter is set to just a digest (@sha256:…) instead of the full ECR URI.

Expected result

Copilot should build the Docker image, push it to ECR, and create a task definition with the full image URI.

Steps taken

  • Verified I’m on the latest Copilot version.
  • Deleted the service and environment stacks with copilot svc delete.
  • Deleted the ECR repository for the service.
  • Deleted the associated SSM parameter under /copilot/applications/<app>/components/<service>.
  • Re‑ran copilot svc init with the same service name and Dockerfile.
  • Copilot recreated the manifest but did not recreate the ECR repository.
  • Recreated the repository myself with aws ecr create-repository and tried deploying again; the same null or empty error persists.

It feels like a regression of the old v1.28/v1.29 upgrade/downgrade bug, but this application was created and deployed with v1.33+.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugIssues that are bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions