Pull, Tag and Push an Image from Registry Y to Registry X

2/27/2019

Currently, our CI/CD Environment is cloud based in Kubernetes. Kubernetes Cloud Providers recently removed the docker deamon, due to performance advantages. For example Google Kubernetes Engine or IBM Cloud Kubernetes only feature an Containerd runtime, to run but not build container images.

Many tools like kaniko or jib fix this gap. They provide a way to build docker images very effectivly without requiring a docker deamon.

Here comes the Problem:

  1. Image "registry-x.com/repo/app1:v1-snapshot" gets build from jib in CI to registry-x.
  2. Image "registry-x.com/repo/app1:v1-snapshot" is then at some point of time deployed and tested and needs to be delivered to the registry Y if the test is successfull as well as needs to be marked as stable release in registry X.

So Image "registry-x.com/repo/app1:v1-snapshot" needs to be tagged from "registry-x.com/repo/app1:v1-snapshot" to "registry-x.com/web/app1:v1-release" and then it needs additionally to be tagged with "registry-y.com/web/app1:v1-release" and both need to be pushed.

Outcome: The Snapshot image from development is available in both registries with a release tag.

So how to do these simple 3 operations (Pull, Tag, Push) without a docker deamon? Seems like kaniko and jib are not a way.

I dont want to order an VM only to get a docker deamon to do these operations. And I also know that Jib is capable of pushing to multiple registries. But it is not able to just rename images.

Relates also to this Question from last year: Clone an image from a docker registry to another

Regards, Leon

-- LeonG
continuous-integration
docker-registry
jib
kaniko
kubernetes

1 Answer

2/27/2019

Docker Registry provides an HTTP API, so you could those methods to pull and push images.

There are several libraries providing an higher abstraction layer over it (docker-registry-client in Go, docker-registry-client in Js, etc).

In any case, the flow will be

-- Gonzalo Matheu
Source: StackOverflow