Buy @ Amazon

Search This Blog

March 7, 2019

Update docker containers when its image is updated


Imagine you have your Microservices A-E managed by Teams 1-3 like shown below:

Now when you have each of your services containerized with docker and you use docker-compose to deploy the entire set of services as one logical unit as your application. One of the core-points of a microservice is loosely-coupled services that are independently deploy-able.

And when you as a newbie with these tools wonder how do you deploy a service with  new code changes, you should understand that this involves two steps:
  1. Update the container-image with a newer one. Your build tool (maven/gradle in Java/JEE world) will do this for you.
  2. Update the container services to reflect the newer/updated image. This is done with docker-compose like below:
$ docker-compose -f docker-compose.yml up yourService
You pass the docker-compose file with -f option and say whether you want to up/down a specific service. The up command automatically checks for updated image and rolls out the changes for you. Bingo!

No comments:

Post a Comment

Like it or hate it, feel free to share your feedback. Cheers!