[Bug]: Service deploy fails, TaskDefinition Container.image is null when using image.build
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.buildsection 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 initwith 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-repositoryand tried deploying again; the samenull or emptyerror 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+.
Same issue here! There doesn't seem to be any way for us to deploy a new job. Ours is a Scheduled Job.
copilot deploy results in "The repository with name '[name]' does not exist"
and after creating the ECS repository manually, we run into the same error during deployment:
Invalid request provided: Create TaskDefinition: Container.image repository should not be null or empty.
For anyone else facing this issue, here is a hacky workaround that worked for us:
- Create the ECR repo manually
- Run
copilot deploy-> It fails, but the image gets created successfully - Take the image ARN and in
manifest.yml, point it to the image directly instead of having it build the docker image:
image:
# build: Docker
location: <image arn>:latest
- Run
copilot deployand it deploys the task properly