I'm trying to set up deployment where on docker compose up
command it would build necessary images, push them to ECR and launch everything on ECS.
What I've done so far.
docker context create ecs aws
docker context use aws
docker-compose.yml
file:version: '3.9'
services:
frontend:
build: ./frontend
image: <my_aws_id>.dkr.ecr.<region>.amazonaws.com/frontend:latest
backend:
build: ./backend
image: <my_aws_id>.dkr.ecr.<region>.amazonaws.com/backend:latest
nginx:
build: ./nginx
image: <my_aws_id>.dkr.ecr.<region>.amazonaws.com/nginx:latest
ports:
- 80:80
After reading a bunch of manuals, to my understanding, command docker compose up
should:
Instead I'm having error that telling me that those images are not found. Yes, my ECR repo is empty, but I expect docker compose up
to build and push images to that repo, not just try to get them from ECR.
What am I doing wrong?
The purpose of the command is to bring the services up
locally:
❯ docker-compose --help
...
create Create services
push Push service images
start Start services
up Create and start containers
Depending on context it may as well build and pull images, create or update containers, and of course, start services, but it does not push
. If you intend to use docker-compose to push images, I suggest you manually run build and push commands:
docker-compose build
docker-compose push