1

I'm setting up a CI/CD workflow for my organization but I'm missing the final piece of the puzzle. Surely this is a solved problem, or do I have to write my own?

The full picture.

I'm running a few EC2 instances on AWS, each running docker in its native swarm mode. A few services are running here which I've started manually via docker service create ....

When a developer commits source code a trigger is sent to jenkins to pull the new code and build a new docker image which is then pushed to my private registry.

All is well and good up to here, but how do I get the new image onto my docker hosts and the running container automatically updated to the new version?

Docker documentation states (here) that the registry can send events to configurable endpoints when a new image gets pushed onto it. This is what I want to automatically react to by having my docker hosts then pull the new image and stop, destroy and restart the service using that new version (with the same env flags, labels, etc etc), but I'm not finding any solution to this that fits my use case.

I've found v2tec/watchtower but it's not swarm-aware nor can it pull from a private registry at the time of writing this question.

Preferably I want a docker image I can deploy on my docker manager which listens to registry events (after pointing the registry config at it) and does the magic I need.

Cost is an issue, but time is less so, so I'm more inclined writing my own solution than I am adopting a fee-based service for this.

jbr
  • 11
  • 1
  • Here when you refer as private registry is Amazon EC2 container registry or Dockerhub? One option you have is to SSH to swarm master from jenkins using remote SSH plugin and pull the new image and update the service upon image push. – Ashan Apr 25 '17 at 21:22
  • By private registry I mean using the docker registry via `docker pull registry`. Thank you for your suggestion using ssh plugin. I'll consider this. – jbr Apr 26 '17 at 06:44

1 Answers1

0

One option you have is to SSH to swarm master from Jenkins using SSH plugin and pull the new image and update the service when new image is pushed to the registry.

Ashan
  • 18,898
  • 4
  • 47
  • 67