Can Google Container Registry (gcr) support Docker Image Manifest V 2, Schema 1? - google-container-registry

From https://cloud.google.com/container-registry/docs/image-formats, I see gcr supports Docker Image Manifest V 2, Schema 1. However when I try to get the schema 1 manifest for an image (gcr.io/google-containers/busybox) via curl, it failed:
Unexpected HTTP response '404 Not Found' when trying to get the schema 1 manifest
So I am confused if gcr really support it or not.

What's your actual curl command?
Try
curl -v -H "Accept: application/vnd.docker.distribution.manifest.v1+prettyjws" https://gcr.io/v2/google-containers/busybox/manifests/latest

Related

OpenStack Keystone: "The service catalog is empty." after issuing any command

I'm just back after installing Keystone following the OpenStack docs: Install and configure of Keystone.
I'm running CentOS 7 and OpenStack Stein.
I've noted on this page a missing step on the recipe (keystone-manage db_sync that creates the tables on keystone DB and keystone-manage bootstrap ... well, I'd like to know what exactly performs this command!).
Well, issuing the command:
openstack domain create --description "An Example Domain" example
(as documented in Create a domain, projects, users, and roles) I get the following message:
The service catalog is empty.
Also issuing the command openstack domain list I get the same result.
On /var/log/keystone.log I have:
WARNING keystone.access_rules_config.backends.json [-] No config file found for access rules, application credential access rules will be unavailable.: IOError: [Errno 2] No such file or directory: '/etc/keystone/access_rules.json'
On /var/log/httpd/keystone_access.log I have all 201 (Created) status or 200 when raising commands.
So, it's sure I'm missing something in my configuration; I've already googled around with no results; any help will be strongly appreciated.

Problem listing Google Container Registry images via Docker Registry HTTP API V2

We have some problem trying to list Google Container Registry images via Docker Registry HTTP API V2
When executing this command:
curl -k -s -X GET "https://eu.gcr.io/v2/_catalog" -L -H 'Authorization: Bearer ${TOKEN}'
Sometimes we get an empty json {"repositories":[]} and sometimes we get the correct json with all the information {"repositories":["projectname/image1","projectname/image1"]}
Does Google Container Registry fully support Docker Registry HTTP API V2?
Is anybody else experiencing this issue?

Tensorboard Unavailable: Error executing an HTTP request: libcurl code 6

When I try to run tensorboard with a logdir in google cloud storage I get the following error (with various retry attempts):
Error executing an HTTP request: libcurl code 6 meaning 'Couldn't
resolve host name', error details: Couldn't resolve host 'metadata'
I have previously run gcloud auth and can be confident that I am authenticated correctly because I can read from the given logdir by running
gsutil ls gs://path/to/logdir
which works as expected.
Any idea how to proceed so that I can run tensorboard against this logdir?
This was happening because the GOOGLE_APPLICATION_CREDENTIALS environment variable was not set.
Seems that gsutil was authenticated ok with the gcloud auth ... command but that tensorboard also needed the GOOGLE_APPLICATION_CREDENTIALS env to be set to point to the key file

Invalid audio source error in google cloud speech API

I have followed google's tutorial with gcloud tool to set up everything to use the cloud speech API. However when I am trying to send the following request:
gcloud ml speech recognize 'gs://cloud-samples-tests/speech/brooklyn.flac' --language-code='en-US'
I keep getting the following error:
ERROR: (gcloud.ml.speech.recognize) Invalid audio source ['gs://cloud-samples-tests/speech/brooklyn.flac']. The source must either be a local path or a Google Cloud Storage URL (such as gs://bucket/object).
I also tried google's tutorial to use the speech API from command file using curl request... but when I sent the following request I haven't got any response
curl -s -H "Content-Type: application/json"
-H "Authorization: Bearer "$(gcloud auth print-access-token)
https://speech.googleapis.com/v1/speech:recognize
-d #sync-request.json
I don't know what I am doing wrong... Any help would be really appreciated.. Thanks in advance
The commenter is exactly right, for some reason the quotes to the file argument are the problem. This appears to be true for both local files and Google Cloud Storage hosted file. I had the exact same problem and removing the quotes cures things. It's possible that this is a platform specific issue - I am using gcloud on Windows 10.
I had similar issue. Finally figured out that I had to remove the backslash after the audio file name brooklyn.flac
Gcloud Quickstart has it like this:
gcloud ml speech recognize gs://cloud-samples-tests/speech/brooklyn.flac \ --language-code=en-US
I just used the below after removing the backslash:
gcloud ml speech recognize gs://cloud-samples-tests/speech/brooklyn.flac --language-code=en-US
For me, on the command line of windows 7, the following finally worked:
gcloud ml speech recognize gs://cloud-samples-tests/speech/brooklyn.flac --language-code="en-US"
I had this same issue on Mac OS when referencing a local file. When I deleted the quotes, it worked fine.
This did not work
gcloud ml speech recognize-long-running '/Users/interview/STEREO/FOLDER01/ZOOM0001.WAV'
--language-code='en-US' --async
Deleting the quotes like below did. Go figure.
gcloud ml speech recognize-long-running /Users/interview/STEREO/FOLDER01/ZOOM0001.WAV
--language-code='en-US' --async

Batch docker registry manifest deletion: How to list manifests via v2 REST api?

I would like to delete particular or all manifests in my private docker registry remotely (v2 api) to make it possible images data to be collected by gc. I found this tool, but it only works with tags. I decided to extend it. I would like to enumerate manifests. Is it possible to get manifests list? I can't find something useful on this.
I checked those and I'm also searching the web, but with no success.
https://docs.docker.com/registry/spec/api/
https://docs.docker.com/registry/garbage-collection/
--UPDATE--
Either of both results in 404 error of course (I just prefer using wget). For
https://<registry-origin>/v2/gk-backend/tags/list
I got {"name":"gk-backend","tags":["latest"]} as I expect. When I try father to get the manifest I have 404. I issue the request by using wget like
wget --method=HEAD --header="Accept: application/vnd.docker.distribution.manifest.v2+json" --no-check-certificate --http-user user --http-password pass https://<registry-origin>/v2/wjs-wealth/manifests/gk-backend:latest -O-
And curl also gives me 404
curl --header "Accept: application/vnd.docker.distribution.manifest.v2+json" -sI --user user:pass https://<registry-origin>/v2/wjs-wealth/manifests/gk-backend:latest
I have the same problem. If the a docker image (called manifest) pushed to Docker registry v2.0 with same tag, new manifest will take the tag and the old one will NOT deleted instead of existed with no tag assigned.
Such old manifests cannot list from REST API without knowning their digests, and garbage collection will not delete them.
One way I found to get list of manifests of a docker registry repository is via garbage collection tool. Run docker exec -it registry registry garbage-collect --dry-run /etc/docker/registry/config.yml. This command will print all manifests (including those assigned tag) of all repositories. Such as:
hello-world
hello-world: marking manifest sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf
hello-world: marking blob sha256:03f4658f8b782e12230c1783426bd3bacce651ce582a4ffb6fbbfa2079428ecb
hello-world: marking blob sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
hello-world: marking configuration sha256:690ed74de00f99a7d00a98a5ad855ac4febd66412be132438f9b8dbd300a937d
ubuntu
4 blobs marked, 0 blobs eligible for deletion
With grep tool, it is easy to filter out manifest information only.
Then you can call delete REST API to delete unused manifests. Take attention not to delete those manifest with tag assigned.
DELETE REST API only remove manifest information, image data in blob will not delete, so run garbage collection command again without --dry-run to remove unused blob: docker exec -it registry registry garbage-collect /etc/docker/registry/config.yml
You need to run this command to get a list of your tags
curl https://<registry>/v2/<repoName>/tags/list
Now we want the manifest for each tag - because we don't want to delete it as per comphilip's answer.
curl -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -sI "https://<registry>/v2/<repoName>/manifests/<tag>" | grep "Docker-Content-Digest" | sed 's/Docker-Content-Digest: //;s/\r$//'
It is very important to include the header otherwise you get a different Docker-Content-Digest.
This will give you a list of manifests you need to exclude.
Alternatively you can use this method: docker registry cleanup