So I'm trying to push my docker image to gcr.io/docker-url, but it's not working. I've tried the documentation that Google has, but that's still failed (https://cloud.google.com/container-registry/docs/advanced-authentication#standalone_docker_credential_helper). I also tried:
docker login gcr.io
and
docker login us.gcr.io
Here's the command I run and my error:
docker push gcr.io/docker-url/jenkins/container
The push refers to repository [gcr.io/docker-url/jenkins/container]
d7ab52d2e8be: Pushing [==================================================>] 2.56kB
fae569eb21a4: Pushing 1.536kB
7a20d9096c74: Pushing [====> ] 735.7kB/7.854MB
a26d457fd72d: Pushing [> ] 60.93kB/6.055MB
36f2fac55108: Pushing [> ] 502.8kB/49.16MB
4cd936335289: Waiting
f1b5933fe4b5: Waiting
denied: Access denied.
For reference, I used the json file to login. I even tried all of the StackOverflow answers I could find, but no luck there, either.
In case anyone else is running into this issue and can't figure it out, I fixed it by running this command:
gcloud auth activate-service-account --key-file key-file.json
And then ran my docker push command and it pushed through.
I have an image I've built locally but I'm not allowed to push it even though I am logged in.
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
voyen/client-management latest 5c84a2c3546c 5 seconds ago 640MB
I then log in successfully and try to push it
$ 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: voyen
Password:
WARNING! Your password will be stored unencrypted in /home/andrei/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
$ docker push voyen/client-management:latest
The push refers to repository [docker.io/voyen/client-management]
3d081147e901: Preparing
0027ee5a2387: Preparing
19af2ea5c48a: Preparing
b98fdbf8cf7f: Preparing
ad6eaafe7ab3: Preparing
57eab9d93a79: Waiting
364be905de1c: Waiting
6257fa9f9597: Waiting
578414b395b9: Waiting
abc3250a6c7f: Waiting
13d5529fd232: Waiting
denied: requested access to the resource is denied
Am I missing something?
I'm trying to execute docker commands inside of a Docker container (don't ask why). To do so I start up a container by running.
sudo docker run -v /var/run/docker.sock:/var/run/docker.sock -it my_docker_image
I am able to run all of the docker commands (pull, login, images, etc) but when I try to push to my remote (Gitlab) registry I get denied access. Yes, I did do a docker login and was able to successfully log in.
When looking at the Gitlab logs I see an error telling me no access token was sent with the push. After I do a docker login I see a /root/.docker/config.json with the remote url and a string of random characters (my credentials in base 64 I believe)? I'm using an access token as my password because i have MFA enabled on my Gitlab server.
Appreciate the help!
I ended up resolving the issue by using docker:stable as my runner image. Not quite sure what the problem was with the centos:centos7 image.
Hi i'm trying docker push
[docker-simple-httpserver]# docker push myregistry/simplehttpserver:latest
The push refers to a repository [myregistry/simplehttpserver] (len: 1)
Sending image list
FATA[0000] Error: Status 403 trying to push repository simplehttpserver: "{\"error\": \"Unauthorized updating repository images\"}"
is there a way for me to specify the username and password on docker push command?
I would think they keep passwords off the command line for security reasons.
The way to do it is to login first then push.
https://docs.docker.com/mac/step_six/
$ docker login --username=maryatdocker --email=mary#docker.com
Password:
WARNING: login credentials saved in C:\Users\sven\.docker\config.json
Login Succeeded
Then push
$ docker push maryatdocker/docker-whale
The push refers to a repository [maryatdocker/docker-whale] (len: 1)
7d9495d03763: Image already exists
c81071adeeb5: Image successfully pushed
Typically you would specify your password using the interactive docker login then do a docker push.
For a non-interactive login, you can use the -u and -p flags:
docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"
The Travis CI docs for docker builds gives an example of how to automate a docker login.
See docker login for more details.
As far as I know you have to use docker login. The credentials will be stored in /home/user/.docker/config.json for following docker pushes.
If you are after automation the command expect will be interesting for you.
In case, one needs to login to the custom docker repo, use below:
docker login -u ${USERNAME} -p ${PASSWORD} ${DOCKER_REPOSITORY}
The accepted answer works perfectly fine! However, if you are trying to access a private registry, you may have to consider making the following change request.
docker login -u ${user_name} ${private_registry_domain}
Provide password, when it prompt for the same.
docker login --username=YOUR_DOCKERHUB_USERNAME
In this case your dockerhub password will be an access token.
Refer: https://docs.docker.com/docker-hub/access-tokens/#create-an-access-token
If you are tagging image with IP then login docker registry with IP, If you are tagging image with domain-name then login docker with domain-name, Somehow docker doesn't like mixing IP and domain and failing.
Not direct answer to the question, but you can first login and then do docker push.
docker login -unice-username
After which it will prompt for a password. After successful login you can do docker push.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
use "sudo docker login" not "docker login" as one uses the root account and the other uses your personal.
Personally I create the repo on dockers website prior to the upload.
When I tried to push my Java container on Bluemix using the command:
docker push registry.ng.bluemix.net/shru19
It asked me for username, password and email so I put my Bluemix user id and password but it didn't accept it.
Can you suggest what is it asking?
The IBM Container registry uses a login token which will be refreshed when you log in. When you receive a login prompt when performing a docker push, that should be an indication that the token is invalid and needs to be refreshed.
Run cf ic login to get the token refreshed and then re-run your docker push command.