<p>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 <strong>run</strong> but not <strong>build</strong> container images.</p>

<p>Many tools like <a href="https://github.com/GoogleContainerTools/kaniko" rel="nofollow noreferrer">kaniko</a> or <a href="https://github.com/GoogleContainerTools/jib" rel="nofollow noreferrer">jib</a> fix this gap. They provide a way to build docker images very effectivly without requiring a docker deamon.</p>

<p><strong>Here comes the Problem:</strong></p>

<ol>
<li>Image "registry-x.com/repo/app1:v1-snapshot" gets build from jib in CI to registry-x.</li>
<li>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.</li>
</ol>

<p>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.</p>

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

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

<p>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.</p>

<p>Relates also to this Question from last year:
<a href="https://stackoverflow.com/questions/44974656/clone-an-image-from-a-docker-registry-to-another">Clone an image from a docker registry to another</a></p>

<p>Regards, Leon</p>

<p>Docker Registry provides an <a href="https://docs.docker.com/registry/spec/api/" rel="nofollow noreferrer">HTTP API</a>, so you could those methods to pull and push images. </p>

<p>There are several libraries providing an higher abstraction layer over it (<a href="https://github.com/heroku/docker-registry-client" rel="nofollow noreferrer">docker-registry-client in Go</a>, <a href="https://www.npmjs.com/package/docker-registry-client" rel="nofollow noreferrer">docker-registry-client in Js</a>, etc).</p>

<p>In any case, the flow will be </p>

<ul>
<li><p><a href="https://docs.docker.com/registry/spec/api/#pulling-an-image" rel="nofollow noreferrer">Pulling an image</a> involves:</p>

<ul>
<li><a href="https://docs.docker.com/registry/spec/api/#manifest" rel="nofollow noreferrer">Retrieve manifests</a> from <code>registry-x.com/repo/app1:v1-snapshot</code>.</li>
<li><a href="https://docs.docker.com/registry/spec/api/#blob" rel="nofollow noreferrer">Download</a> of the layers (blobs) named on the manifest.</li>
</ul></li>
<li><p><a href="https://docs.docker.com/registry/spec/api/#pushing-an-image" rel="nofollow noreferrer">Pushing an image</a> involves:</p>

<ul>
<li>Upload all layers you previously downloaded</li>
<li>Modify the original manifest with your new version</li>
<li>Upload the new manifest</li>
</ul></li>
</ul>
