Question

API to push docker images on Container registry

Posted October 22, 2021 125 views
APIDigitalOcean Container Registry (DOCR)

I was following https://docs.digitalocean.com/reference/api/api-reference.
As per my understanding, There can be a single registry, inside which I can create multiple repositories

I am confused whether “image” and “repository” mean the same ?

Also, I want to push a few docker images which are already built on my local. Which API can be useful for that purpose, because I couldn’t find any API saying “Create repository”

Please let me know if I have a misconception here

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello,

The API allows you to manage your Docker registry, but in order to push a Docker image to your Registry, you could follow these steps here:

doctl registry login

Use the docker tag command to tag your image with the fully qualified destination path:

docker tag <my-image> registry.digitalocean.com/<my-registry>/<my-image>

Use the docker push command to upload your image:

docker push registry.digitalocean.com/<my-registry>/<my-image>

If you push a new image using an existing tag, the tag gets updated but the old image is still accessible by its digest and takes up space in your registry.

To reduce your storage usage, you can delete the untagged images and then run garbage collection.

Best,
Bobby