Programmatically get docker manifest - docker

I’m using the aws-sdk for nodejs for pushing a docker image to the aws ecr using this call:
https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_PutImage.html#API_PutImage_RequestSyntax
In code the sdk asks for the docker manifest which I don’t understand. I don’t have a way to get the manifest through dockerode (the npm package I use for talking to the docker api) and the ‘docker manifest’ cli command seems to be epirimental. How do I get the manifest, which is a json document described here:
https://docs.docker.com/registry/spec/manifest-v2-1/

I might be on the wrong track. It says in the documentation:
This operation is used by the Amazon ECR proxy, and it is not intended
for general use by customers for pulling and pushing images. In most
cases, you should use the docker CLI to pull, tag, and push images.
So I may not be able to use this as I intended

Related

Docker: Documentation declaring `docker.io/library` registries?

I am working with Docker through the Fabric8's Docker Maven Plugin.
That requires me to fully qualify the images because login happens at the beginning, so <from>mongo:5</from> is rejected by our company's registry.
So, by default, docker works with docker.io/library.
Right?
Because I did not find this anywhere on https://hub.docker.com/.
The only mention I found is here: https://docs.docker.com/registry/introduction/
Just along the way with the naming conventions documentation:
docker pull ubuntu instructs docker to pull an image named ubuntu from the official Docker Hub. This is simply a shortcut for the longer docker pull docker.io/library/ubuntu command
1) Is this default registry docker.io/library/ defined anywhere?
(Similarly to what Maven has in the "Super POM" which is actually available in the distribution archives MAVEN_HOME/lib/maven-model-builder-3.2.3.jar and available through e.g. mvn help:effective-pom.)
2) My scripts also work with just docker.io/mongo:5. Why is that? What is the relation between docker.io/ and docker.io/library/?

What is the Docker URL on a proget instance

We are using Proget as our Docker Repository of choice and we are running into size issues rapidly. There isn't a good mechanism to prune pre-releases or old images that are no longer needed like there is for other artifacts.
I am using Docker.Dotnet nuget library and have a process where I can connect to a Docker API, evaluate the images using their tags and label or purge what has aged out.
The issue I am running into is that I cannot find the Docker API URL:Port anywhere. My current setup is myrepo.com/docker (and is what I have registered locally), but I cannot connect my Docker client to it.
We are planning on migrating away from this repository anyhow, but this would apply for any other docker repository of choice. For example, what is the URL of the docker hub for API interaction?
Did you look at the ProGet Retention Rules? There's a section on Container rules that seems to already purge what you want...

Pulling Docker Images - Manifest not found

I'm trying to download a tagged docker image
docker pull clkao/postgres-plv8:10-2
and, in a compose file,
postgres:
image: clkao/postgres-plv8:10-2
But receive a manifest not found exception.
Unless I'm mistaken, that tag exists in Docker Hub, however I notice that it doesn't appear on the tags list.
Am I doing something wrong? Or is this perhaps an issue with Docker Hub or the way that repo has been set up?
If it isn't 'my fault', what's a recommendation to move forward? Create my own Dockerfile perhaps?
You might also try
docker pull -a <image>.
The -a will pull all versions of that image, which at least lets you know what is there.
(This is less useful if you really need a specific version, but helped me when I tried to pull an image that for some reason did not have a 'latest' tag.)
Edit: This is actually a really bad idea, since it will pull down the entire history, which for many repositories could be many GB. Better to go look at the repository site and see what tag you want. Note to self: don't post answers when you are tired. :-(
You get the error message because there exist no tag with "10-2".
You can try to figure out why and contact the repository owner or you can try to build your own one.
I just got over this "manifest for / not found: manifest unknown: The named manifest is not known to the registry."
Using
docker login <repo>
Check the docker's image also not only that the tag exists, I was trying to run Flyway version 5.0.1 for an image flyway/flyway which version did not exist, it existed only in version flyway/flyway:latest it seems, whereas 5.0.1 existed and I pulled it but in/from a different repository name, with repository name boxfuse/flyway.
for the error message 'docker manifest unknown'
When you use docker pull, without a tag, it will default to the tag :latest. Make sure that when we are building a image add tag latest or we can access the image by the tag name after image name with colon
I think you are trying to tag your image as v8.10.2. Make sure while tagging image locally you use same tag which you want to pull in future. So steps will be like below:
docker build -t clkao/postgres-pl:v8.10.2 .
docker push clkao/postgres-pl:v8.10.2
docker pull clkao/postgres-pl:v8.10.2
If this is from Git via docker.pkg.github.com then you need to switch to use ghcr.io. The former is deprecated and does not support the manifest endpoint so some docker clients, when they attempt to download various resources, fail with this error message. If you instead publish your image to ghcr (Github Container Repository), the docker image pulling process should complete successfully.
cd <dir with Dockerfile in it>
docker build -f Dockerfile -t ghcr.io/<org_id>/<project_id>:<version> .
docker push ghcr.io/<org_id>/<project_id>:<version>
More info here: https://docs.github.com/en/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry
Note: The Container registry is currently in public beta and subject
to change. During the beta, storage and bandwidth are free. To use the
Container registry, you must enable the feature preview. For more
information, see "Introduction to GitHub Packages" and "Enabling
improved container support with the Container registry."

Tag not found in repository docker.io/minio

We have been using locked version of the Minio image (RELEASE.2016-10-07T01-16-39Z), but now it seems to have been removed.
I'm getting this from Docker:
Pulling minio (minio/minio:RELEASE.2016-10-07T01-16-39Z)...
Pulling repository docker.io/minio/minio
ERROR: Tag RELEASE.2016-10-07T01-16-39Z not found in repository docker.io/minio/minio
I'm finding Docker hub hard to navigate. Where can I find a list of available versioned images, or a mirror to my exact image?
You can find the available tags for minio/minio on that repository's tag page.
If you have the image you want already downloaded on any of your systems, you can push it to Docker Hub yourself, then pull it onto your other systems. This has the benefit that you can control whether you delete that image (it's your account, not someone else's).
You can also use a private registry, if you want, which would prevent Docker from deleting the image from Docker Hub against your will for some reason. But that is extra work you may not wish to do (you would have to host the registry yourself, set it up, maintain it...)
We removed the docker version due to incompatibilities, from the recent releases it won't happen.

How to list images in docker registry being on registry server?

Currently I'm pushing images from one machine to another. The success of it I can determine base on HTTP status from pushing machine or base on logs from the registry server. At this point I want to search through what really is in my registry on my server. What I found till now is the API calls from outside and that if even when you call it you have to know exact name of the image and how it is tagged. In my case, I want just to enlist what images currently are in my registry when I have direct access to it. I did not find any related command.
The docker CLI doesn't have functionality to search a registry, but you can use the registry's REST API. Assuming you're using the registry:2 image, then you can list all the repositories using the catalog endpoint:
curl https://my-registry:5000/v2/_catalog
{"repositories":["busybox","redis","ubuntu"]}
And then you can query the tags for a repository:
curl https://my-registry:5000/v2/busybox/tags/list
{"name":"busybox","tags":["2","latest"]}
Here's the full Registry API spec.

Resources