So I create a Docker hub image as follows, worked fine
Created new empty repository in DockerHub
Uploaded my DockerFile to my webserver
ssh *qnapserver*
docker build *DockerFileUrl*
docker login *DockerHubUsername* *DockerHubPassword*
docker images (to get imageId of built image)
docker tag *imageId* *DockerHubNameSpace*/*DockerHubRepository*:latest
docker push *DockerHubNameSpace*/*DockerHubRepository*:latest
A few weeks later I need to rebuild image for new software version, so I did
ssh *qnapserver*
docker build *DockerFileUrl*
docker login *DockerHubUsername* *DockerHubPassword*
docker images (to get imageId of built image)
docker tag *imageId* *DockerHubNameSpace*/*DockerHubRepository*:latest
docker push *DockerHubNameSpace*/*DockerHubRepository*:latest
but the final push command fails with
The push refers to a repository [docker.io/songkong/songkong-arm32]
d68f3fa1b903: Preparing
a0fcc8fd26d0: Preparing
e921eb3da019: Preparing
30b60a45df09: Preparing
8a9717d91a27: Preparing
fcf19287cca0: Waiting
72b719a20b26: Waiting
denied: requested access to the resource is denied
Running docker images gives:
[~] # docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
songkong/songkong-arm32 latest d2ab52ce970a 14 minutes ago 179MB
arm32v6/openjdk 8-jre-alpine d6163b61a7aa 8 days ago 72.9MB
songkong/songkong-arm32 <none> a57032901b5c 2 weeks ago 169MB
songkong/songkong-arm32 <none> 8f3ae4b75feb 2 weeks ago 162MB
The issue seems to be that I wasnt logged onto DockerHub properly
docker login *DockerHubUsername* *DockerHubPassword*
did not return an error, but I tried doing
docker login
and entering username and password at the prompt and then the push worked ok.
Are you using Docker for Mac ?
There is a bug with the docker login CLI command.
Please see this github issue and add your experience if you can :
https://github.com/docker/for-mac/issues/2016
Related
I have encountered a problem a few days ago and it drives me crazy. I have few services running on gitlab-ci.
A few days ago when, i tried to i run "docker-compose pull" or "docker pull image:version" and it failed. The weird thing is that nothing changed and it worked so far. For some services it says pull access denied because it requires docker login or repository does not exist. I run docker login before making pull, images exist and repository too. I don't understand. This is what happens when I run docker-pull compose. Docker pull is a success for some of them.
enter image description here
I have a virtualbox development:
$docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
development - virtualbox Running tcp://*.*.*.*:**** v18.05.0-ce
Inside development I have this:
$docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest e1ddd7948a1c 1 day ago 1.16MB
pritam/play-docker latest 34eb2664f14e 1 day ago 1.4GB
Now I want to push this image inside virtual box to google repository. How do I that?
you can use docker push command
docker push imageTagName
http://docs.docker.com/engine/reference/commandline/push
For your own registry you can use
docker push registry.example.com/image
http://blog.docker.com/2013/07/how-to-use-your-own-registry.
And for google container registry reference:
http://cloud.google.com/container-registry/docs/pushing-and-pulling
docker [push/pull] gcr.io/{PROJECT_ID}/{image}:tag
for authentication you can check google container registry reference
https://medium.com/google-cloud/using-googles-private-container-registry-with-docker-1b470cf3f50a
after you get google auth keys as json format (key.json)
docker login -u _json_key -p “$(cat key.json)”
after login success you can push your image
docker push gcr.io/project_id/imageName:tag
I built a Docker image that I pushed to Docker Hub under my account and removed locally after. But when I try to pull it, it throws the following error:
Error response from daemon: pull access denied for mightyspaj/dockerfile-assignment-1, repository does not exist or may require 'docker login'
I'm logged into the same account that owns the repository for this image and can perform other tasks (such as pushing) perfectly fine. The repository also definitely exists on Docker Hub, yet it fails when I try to pull it.
I've tried the following things:
Logging out of my account and back in again
Renaming config.json and regenerating it
Running an isolated Docker container with docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock:ro docker sh, then logging into my account and attempting to pull the image
Deleting and recreating the repository
All of these things still produce the same error. I'm baffled.
To note, both my client and engine versions are 17.12.0-ce. My OS is Ubuntu 17.10 (64-bit).
Console output
docker login
-> % docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: mightyspaj
Password:
Login Succeeded
docker tag
-> % docker tag dockerfile-assignment-1:latest mightyspaj/dockerfile-assignment-1
docker push
-> % docker push mightyspaj/dockerfile-assignment-1
The push refers to repository [docker.io/mightyspaj/dockerfile-assignment-1]
8427a8e6a29f: Pushed
655a921743e8: Pushed
8aa44edb7524: Pushed
60f1a2dc4cd8: Mounted from library/node
9185fe936b87: Mounted from library/node
e53f74215d12: Mounted from library/node
latest: digest: sha256:6c68220ba84f13d0229ef4458f22369410bb98764b908a75be0849c3003de160 size: 1582
docker image rm
-> % docker image rm mightyspaj/dockerfile-assignment-1
Untagged: mightyspaj/dockerfile-assignment-1:latest
Untagged: mightyspaj/dockerfile-assignment-1#sha256:6c68220ba84f13d0229ef4458f22369410bb98764b908a75be0849c3003de160
docker image pull
-> % docker image pull mightyspaj/dockerfile-assignment-1
Using default tag: latest
Error response from daemon: pull access denied for mightyspaj/dockerfile-assignment-1, repository does not exist or may require 'docker login'
I could fix the same issue only when I made the repository public. Make sure the repository is public then this is the set of instructions I followed in command line:
Once logout from docker hub and login again.
1- docker logout
2- docker login --username=YOURUSERNAME
Enter password when asked
3- docker pull repositoryName"/"imageName[:tag]
if "tag" is not included the default value will be "latest".
Then check the images by docker images command to check if its been pulled.
After pulling is done I made the repository private again.
This solution is only valid on private docker repositories!!
First try to login on your private repo e.g:
docker login dockerrepo.example.com
Then
If you build new image with dockerfile based on image in your private repository then you must prefix your base image with private repository url:
FROM PRIVATE_REPO_URL + IMAGE_INFO
sample:
PRIVATE_REPO_URL --> dockerrepo.example.com
BASE_IMAGE --> samples/java/jdk:1.6
Your dockerfile look like this:
FROM dockerrepo.example.com/samples/java/jdk:1.6
I'm new to Openshift and Docker.
I created a new project on Openshift, and a new image stream as well so I can push a docker image I created to the docker repository inside my Openshift project.
After login in with docker to the registry as explained in the Openshift documentation, and getting a Login succeded message, I went ahead to tag my image, and push it to the image stream, only to get a message stating Unauthorized: authentication required.
sudo docker login -u `oc whoami` -p `oc whoami -t` registry.starter-us-east-1.openshift.com
sudo docker tag test:latest registry.starter-us-east-1.openshift.com/rolabot/test
sudo docker push registry.starter-us-east-1.openshift.com/rolabot/test
This last command returns
3ea53db680fc: Pushing [==================================================>] 12.8 kB
54f43adb4662: Pushing 1.536 kB
49907af65b0a: Pushing [==================================================>] 3.072 kB
4589f96366e6: Pushing [==================================================>] 5.632 kB
b97229212d30: Pushing 14.85 kB
cd181336f142: Waiting
0f5ff0cf6a1c: Waiting
unauthorized: authentication required
To me, it seems like this is an issue with the upstream Docker Registry cache in Origin. This seems to be a known issue in minishift, but the remedies they have found are not possible (as you don't have the necessary permissions) on Openshift Online. I would open a new support ticket with Red Hat, so that they can take a look.
I have a GKE cluster running in GCE, I was able to build + tag an image derived from ubuntu:16.04:
/ # docker images
REPOSITORY TAG IMAGE ID
CREATED SIZE
eu.gcr.io/my-project/ubuntu-gcloud latest a723e43228ae 7 minutes ago 347MB
ubuntu 16.04 ebcd9d4fca80 7 days ago 118MB
First I try to log in to registry (as documented in GKE docs)
docker login -u oauth2accesstoken -p `curl -s "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" -H "Metadata-Flavor: Google"|awk -F\" "{ print \$4 }"` eu.gcr.io`
And then the docker push command fails:
# docker push eu.gcr.io/my-project/ubuntu-gcloud
The push refers to a repository [eu.gcr.io/my-project/ubuntu-gcloud]
a3a6893ab23f: Preparing
6e390fa7d62c: Preparing
22b8fccbaf84: Preparing
085eeae7a10b: Preparing
b29983dd2306: Preparing
33f1a94ed7fc: Waiting
b27287a6dbce: Waiting
47c2386f248c: Waiting
2be95f0d8a0c: Waiting
2df9b8def18a: Waiting
denied: Unable to create the repository, please check that you have access to do so.
The token should be valid, in another instance I'm able to gcloud whatever with it; the service account has 'Editor' role on the project.
The weirdest part is when I do docker login with obviously invalid credentials
misko#MacBook ~ $ docker login -u oauth2accesstoken -p somethingverystupidthatisreallynotmypasswordortoken123 eu.gcr.io
Login Succeeded
login always succeeds.
What shall I do to successfully docker push to gcr.io?
Try this:
gcloud docker -- push eu.gcr.io/my-project/ubuntu-gcloud
If you want to use regular docker commands, update your docker configuration with GCR credentials:
gcloud docker -a
Then you can build and push docker images like this:
docker build -t eu.gcr.io/my-project/ubuntu-gcloud .
docker push eu.gcr.io/my-project/ubuntu-gcloud