docker: invalid reference format with own registry with basic AU - docker

I can see my docker registry by
curl -X GET "https://mylogin:mypass#myregistry.mydomain.io:myport/v2/_catalog"
or
curl -X GET "https://mylogin:mypass#myregistry.mydomain.io:myport/v2/myimage/manifests/latest"
but if I start container
sudo docker run -it https://mylogin:mypass#myregistry.mydomain.io:myport/myimage:latest
I receive error
docker: invalid reference format

https://mylogin:mypass#myregistry.mydomain.io:myport/myimage:latest
To login to your registry server, first run:
docker login myregistry.mydomain.io
Then pull the image with:
docker pull myregistry.mydomain.io:myport/myimage:latest
There should be no https:// or user credentials in the image name you pull.

Related

Pulling an image from local Docker registry

I installed a Docker registry to my server like below;
docker run -d -p 5000:5000 --name registry registry:2
So after that I pushed Alpine image to that registry.
docker pull alpine
docker image tag alpine localhost:5000/alpinetest
docker push localhost:5000/alpinetest
So the problem is I want to access this image from another server.
So I can run the command below from client to Docker registry's server;
user#clientserver ~
$ curl 10.10.2.18:5000/v2/_catalog
{"repositories":["alpinetest"]}
So how can I pull this "Alpinetest" image from another "clientserver"?
For example the command below is not working;
user#clientserver ~
$ docker pull 10.10.2.18:5000/alpinetest:latest
Using default tag: latest
Error response from daemon: Get "https://10.10.2.18:5000/v2/": http: server gave HTTP response to HTTPS client
Thanks!
On the machine that wants to pull the image, create or edit /etc/docker/daemon.json and enter this:
{
"insecure-registries": ["10.10.2.18:5000"]
}
and then run:
sudo systemctl restart docker
Just be aware that the registry is, just like it says, insecure. This setup shouldn't be used when the registry is accessed over the internet or in any other environment that you don't have full control over. But it's definitely nice for local tests.

Able to pull acr images but unable to check manifest

I want help in understanding how docker pull works for acr images. I have a private acr repository.
So i run az acr login -n <repo> --expose-token --output tsv --query accessToken to print out the access token.
Then i use this access token to login through docker: docker login <repo>.azureacr.io --username 00000000-0000-0000-0000-000000000000 --password '<ACCESS TOKEN>'. The login works.
Then i try pulling the docker image: docker pull <image>:<tag> which works, but when i do docker manifest inspect <image>:<tag> it fails with the following exception:
errors:
denied: requested access to the resource is denied
unauthorized: authentication required
Questions:
How do i check what permissions I have/need to run these docker commands?
If docker pull is working is it wrong to assume docker manisfest inspect will also work? I mean docker somehow needs to check if the image with the tag exists before pulling it right?

Docker Outside Of Docker login works but image pull from artifactory gives authentication is required error

In the docker host I create .docker/config.json with :
docker login https://project-docker.artifactory.company.com -u User -p Password
In the parent docker, then :
docker pull project-docker.artifactory.company.com/MyImage:1.0.0
works fine, the image is downloaded from the company artifactory register.
And I do :
docker rmi project-docker.artifactory.company.com/MyImage:1.0.0
to remove it from local repo.
Then I run a docker outside of docker with :
docker run -v /var/run/docker.sock:/var/run/docker.sock AnotherImage
Inside the child container (or sibbling), I do :
docker login https://project-docker.artifactory.company.com -u User -p Password
to create the /docker/config.json authentication file, it works fine.
Then when I do :
docker pull project-docker.artifactory.company.com/MyImage:1.0.0
I get the error message :
Error response from daemon: Get https://project-docker.artifactory.company.com/v2/MyImage/manifests/1.0.0: unknown: Authentication is required
When I do :
curl -uUser:Password https://project-docker.artifactory.company.com/v2/MyImage/manifests/1.0.0
then curl manage to download that response.
So curl works from inside the container sibbling, but the docker deamon fails whith the docker pull made from the sibbling.
I know we use virtual sub repositories, because project-docker.artifactory.company.com points to the same IP as project2-docker.artifactory.company.com and docker.artifactory.company.com .
How I can have more precise info about where it goes wrong ?

Not able to sign in using docker to canister.io - Authorization server did not include a token in the response

Ok so I'm trying to make Bitbucket build a docker image using Bitbucket pipelines and I could sign in a week ago but now it doesn't work anymore.
And I'm using the same username and password, here it's a list of the commands I have tried and their output.
docker login cloud.canister.io:5000 --username $CANISTER_USERNAME --password $CANISTER_PASSWORD:
Error response from daemon: Get https://cloud.canister.io:5000/v2/: authorization server did not include a token in the response
docker login --username $CANISTER_USERNAME --password $CANISTER_PASSWORD cloud.canister.io:5000
Error response from daemon: Get https://cloud.canister.io:5000/v2/: authorization server did not include a token in the response
docker login cloud.canister.io:5000 --username $CANISTER_USERNAME
Password: xxxxxxxxxxxxxxxxxxx
Error saving credentials: error storing credentials - err: exit status 1, out: Cannot autolaunch D-Bus without X11 $DISPLAY
echo "$CANISTER_PASSWORD" | docker login cloud.canister.io:5000 --username $CANISTER_USERNAME --password-stdin
Error response from daemon: Get https://cloud.canister.io:5000/v2/: authorization server did not include a token in the response
echo "$CANISTER_PASSWORD" | docker login --username $CANISTER_USERNAME --password-stdin cloud.canister.io:5000
Error response from daemon: Get https://cloud.canister.io:5000/v2/: authorization server did not include a token in the response
I've also tried on a local machine and tried to do it without environment variables also tried to sign out and then try to sign in again but nothing works
for logging in this worked for me:
docker login --username=USERNAME cloud.canister.io:5000
Unfortunately, i am still getting this error message whenever i try to push my image.
I had the same issue when trying to push a new image to cloud.canister.io. It turned out I had not created the repository through the web frontend yet.
After creating the repo on cloud.canister.io I could successfully push my image up.
First you need to create an empty repo on cloud.canister.io
website with same name of the image you are trying to push.
Then you will be able to push to that repo.
Make sure you have authenticated the canister account using
sudo docker login --username=<username> cloud.canister.io:5000
Been a while. But this helped me:
docker push (registryFullUrl)/$(dockerId)/$(imageName):$(MAJOR).$(MINOR).$(PATCH)
where:
$(registryFullUrl) = cloud.canister.io:5000
$(dockerId) = your canister id
$(imageName) = repository name
$(MAJOR).$(MINOR).$(PATCH) = version
This worked for me. Hopefully this will be helpful to somebody.
I built an image from a custom Dockerfile. I am running Docker Desktop on my Win11.
docker build -t <image>:<tag> .
I logged into canister.io.
docker login --username=<username> --password=<username> cloud.canister.io:5000
I tagged the build.
docker tag <image>:<tag> cloud.canister.io:5000/<canister-namespace>/<canister-repo>
I pushed the image to canister.
docker push cloud.canister.io:5000/<canister-namespace>/<canister-repo>
I deleted the image from my Docker Desktop and I tried to pull it from canister.
docker pull cloud.canister.io:5000/<canister-namespace>/<canister-repo>
Here's an examples with some dummy values:
docker build -t tc5:tc5tag .
docker login --username=myusername --password=mypassword cloud.canister.io:5000
docker tag tc5:tc5tag cloud.canister.io:5000/mynamespace/testrepo
docker push cloud.canister.io:5000/mynamespace/testrepo
# pull test
docker pull cloud.canister.io:5000/mynamespace/testrepo

Cannot pull Docker image out of OpenShift cluster

I would like to pull a Docker image that was built inside an OpenShift Container Platform 3.9 cluster out of that cluster. To this end I try the following:
username=$(oc whoami)
api_token=$(oc whoami -t)
docker login -u $username -p $api_token my-cluster:443
image=$(oc get is/my-is -o jsonpath='{.status.tags[0].items[0].dockerImageReference}')
docker pull $image
Now docker login works, but docker image produces the error message
lookup docker-registry.default.svc on 1.2.3.4: no such host
where 1.2.3.4 is a placeholder for my local nameserver according to /etc/resolv.conf and $image is of the form docker-registry.default.svc:5000/registry/my-is#sha256:my-id.
Am I doing something wrong or could it be that the cluster administrator must first expose the registry (but should it not be exposed by default)? If I try oc get svc -n default as suggested here I get this error message:
User "my-user" cannot list services in project "default"
So what steps are needed (preferably without intervention by the cluster's administrator) for me successfully pulling out that image? Would the situation change if the pull occurred in a container also executing inside the OpenShift cluster?
The lead provided in a comment was the right one. (Thanks!). The following script now does work; no intervention by a cluster admin was required:
username=$(oc whoami)
api_token=$(oc whoami -t)
docker login -u $username -p $api_token my-cluster:443
docker pull my-cluster:443/my-project/my-is
docker images

Resources