Having error pushing docker container on Bluemix - docker

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.

Related

Login to Docker Hub by command line

I have read some Docker tutorials and I see this command line:
docker login -u LOGIN -p PASSWORD
But the registry server URL is never set.
How does the docker command know the registry URL? What is the URL for Docker Hub Registry? I have tried this:
docker login -u LOGIN -p PASSWORD cloud.docker.com
but it does not work.
If you want to login to the default Docker Hub repository, simply use:
docker login
or more specifically:
docker login registry-1.docker.io
You can also login using a Docker Hub Access Token: https://docs.docker.com/docker-hub/access-tokens.
To do that:
Access your Docker Hub account.
Click on your avatar (on the page top right side).
Click on Account and Settings.
Click on Security (on the page left side in the middle).
And then click on New Access Token button.
Give a token description, define the token permissions and click on Generate.
Copy and save your token.
Then log in with your new token. Type docker login -u <your-username> on your terminal and paste your Access Token when requested by the password.
docker login -u <your-username>
You may need to use a specific registry version, for me this worked.
docker login registry-1.docker.io/v1
In my case docker daemon is not running, so I just restarted it and re-executed same command. It worked!!
While login you may encountered with permission denied issues, in that case first give bellow command:
sudo chmod 666 /var/run/docker.sock
then use:
docker login

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

Docker login problems [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Created username password on hub.docker.com but I still get authentication error when I run docker run hello-world, and even when I run "docker login" then enter my credentials ....but it shows a success message when I do
docker login -u <myusername> -p <mypassword> https://hub.docker.com
but even after that if I try to run
docker run hello-world
I get the same error:
"error response from daemon: login attempt to https://registry-1.docker.io/v2/ failed with status: 401 Unauthorized"
Try logging out first with docker logout
I often find that this will at least allow me to pull images when there is some authentication issue.
docker logout
docker login
DONOT put email address as “username” when login from CLI. Instead USE username of you account
A few things going wrong here. First the login command shouldn't specify a url. Instead you specify a registry. And for hub, you don't even include that:
docker login -u <myusername> -p <mypassword>
Next, the hello-world image doesn't require any authentication. If you have bad credentials setup, you can logout:
docker logout
If you still see issues after that, the most likely cause is a proxy on your network intercepting the request, and it's not docker Hub giving the 401 error, but instead it's the proxy server. You can configure docker to use a proxy by following both of the following:
Configure the client: https://docs.docker.com/network/proxy/
Configure the engine: https://docs.docker.com/config/daemon/systemd/#httphttps-proxy
Try this command first:
docker logout https://hub.docker.com
You should get an output like:
Removing login credentials...
Then try to login.
I had similar problem, in my case, my solution was, that I need to input the password via STDIN method as below:
first create a file with the content is your docker password, e.g. in ~/my_password.txt
Then login using this method:
cat ~/my_password.txt | docker login --username [your_username_here] --password-stdin
Remember, your username is not your email.
Test docker login With modify Docker General Config (macOS High Sierra 10.13.3 & Docker Engine:18.09.2)
1. With GUI Account login
1.1 With General -> Securely store Docker logins in macOS keychain (checked)
docker login failed
1.2 With General -> Securely store Docker logins in macOS keychain (unchecked)
docker login successed
it will Authenticating with existing credentials.
2. With GUI Account logout
2.1 With General -> Securely store Docker logins in macOS keychain (checked)
docker login failed
2.2 With General -> Securely store Docker logins in macOS keychain (unchecked)
docker login successed
SO,
unchecked General->Securely store Docker logins in macOS keychain, it solved my docker login failed problem

"unauthorized: Unauthorized" message when pushing Docker container to Bluemix

Attempted to push my Docker container onto Bluemix with the command:
sudo docker push registry.ng.bluemix.net/< my username>/testproj:latest
...but it remains in this state:
41e402a30e3e: Preparing
31ea3086ff95: Preparing
7128d7a803a9: Preparing
03b6a8ac8cb2: Preparing
3e76a9f5c51e: Preparing
c747e356ef2e: Waiting
5f2f91b41de9: Waiting
ec0200a19d76: Waiting
338cb8e0e9ed: Waiting
d1c800db26c7: Waiting
42755cf4ee95: Waiting
unauthorized: Unauthorized
So the container doesn't push to Bluemix. How do I resolve this?
Before pushing image to bluemix, you can try out cf ic command to login, it might be possible that your login token become invalid, you can try:
cf ic login
this will reset to valid token.
Reference: https://developer.ibm.com/answers/questions/205155/unable-to-add-docker-image-to-my-bluemix-registry.html
In addition to Rahul's answer, make sure that you run the login as the same user as your docker push command. So, if you need to run your docker push with sudo, make sure to do your cf login and cf ic login with sudo as well.

Docker: How to authenticate for docker push?

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.

Resources