We have a docker-compose file with service like
services:
utils-microservice:
container_name: utils-microservice
image: <Masked>.dkr.ecr.ap-south-1.amazonaws.com/utils-microservice:<Some Tag>
ports:
- '1024:1024'
env_file:
- './envs/utils-microservice.env'
Now, what we want to do?
Once CI Pushes a new TAG to ECR, We can run a shell script to achieve the following
1 Stop the container
2 Replace the utils-microservice:<Some Tag> to utils-microservice:<Some New Tag>
3 Restart the service with new tag!
Is it achievable? we are not looking to complicate using docker swarm or k8's!
CodePudding user response:
It’s possible to use environment variables in your shell to populate values inside a Compose file:
web: image: "webapp:${TAG}"