Docker API v2 API - how to tag and click an image

I want to promote the image from the test to the prod environment. How to use " curl POST " to tag and push images through the docker registry API? (Docker 1.22 API) Equivalent command:

 docker tag my_testrepo:6000/new_test_image:test_tag myprod_repo:5000/new_prod_image:tag docker push myprod_repo:5000/new_prod_image:tag 

How to use curl command to mark image in repo:

 POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1 

Could not find any instructions. I tried many times, everything failed.

+5
source share
1 answer

While researching this problem, I came across this question. The solution I found is resolved in this blog post. Confirm wheleph for solution.

There is essentially no way to mark an existing image, you can simply load the manifest of the existing tag and reload the manifest as a new tag:

 curl /v2/mybusybox/manifests/latest -H 'accept: application/vnd.docker.distribution.manifest.v2+json' > manifest.json 

Then download this manifest file.

 curl -XPUT '/v2/mybusybox/manifests/new_tag' -H 'content-type: application/vnd.docker.distribution.manifest.v2+json' -d '@manifest.json' 
+1
source

Source: https://habr.com/ru/post/1262854/


All Articles