Facing error while login to the ecr from local machine(windows) - docker

I’m encountering an error while login to the ecr from local machine (Windows).
I have used this command for login:
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 26224922****.dkr.ecr.ap-south-1.amazonaws.com
However I am getting the following error:
unknown flag: --password-stdin
See 'docker login --help'.
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp1252'>
OSError: [Errno 22] Invalid argument

Related

Docker login ERROR: x509: certificate signed by unknown

I have a problem :
Since yesterday, when i'm trying to log into my docker account using a bitbucket pipeline.
My pipeline looks like that :
services:
- docker
caches:
- node
- docker
script:
- echo $REGISTRY_PASS | docker login --username $REGISTRY_USER --password-stdin $REGISTRY_URL
I have this error :
ERROR: x509: certificate signed by unknown
Someone could help me ?
Thank you

How to authenticate docker login in Ubuntu 20.0 LTE

I tried login to JFrog artifactory using docker commands:
root#dxc:/home/dxc# echo ${API_Key} | docker login --username 320060162 --password-stdin
But I am facing with the below error:
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I tried to check config.json file:
root#dxc:/home/dxc# cd .docker/
root#dxc:/home/dxc/.docker# cat config.json
{
"auths": {}
}
You need to give artifactory endpoint as well in the docker login command.
echo "your_password" | docker login your_domain.jfrog.io --username "username" --password-stdin
You can manually set your credentials in the config.json file as below:
{
"auths": {
"<the Docker repository endpoint in Artifactory>": {
"auth": "<USERNAME>:<PASSWORD> (converted to base 64)",
"email": "youremail#email.com"
}
}
}

`aws ecr get-login-password` `docker login` The user name or passphrase you entered is not correct

This used to work:
aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin "$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com"
Now, I get:
Error saving credentials: error storing credentials - err: exit status 1, out: `error storing credentials - err: exit status 1, out: `The user name or passphrase you entered is not correct.``
If I run just aws ecr get-login-password, I get a successful result, which suggests I have the right AWS access:
aws ecr get-login-password --region us-west-2 | base64 -d | jq '.'
{
"payload": "redacted",
"datakey": "redacted",
"version": "2",
"type": "DATA_KEY",
"expiration": redacted
}
This command that is failing is in a script that has been run successfully many times before and hasn't been changed. Has something changed in new versions of Docker that would break this? Or new versions of the Amazon CLI client? One possibility, is my AWS account privileges have changed, but I would have expected the above get-login-password command to have not succeeded in that case.
This login method is documented here, and I seem to be following instructions exactly:
https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login-password.html
Is there anything I can do to troubleshoot this?

Error response from daemon: Get "https://ghcr.io/v2/": denied: denied

While using with the GitHub action I am getting Error response from daemon: Get "https://ghcr.io/v2/": denied: denied
I used the login command echo $CR_PAT | docker login ghcr.io -u $ghcr_user -password-stdin
I believe the command you want should be:
echo "$CR_PAT" | docker login ghcr.io -u "$ghcr_user" --password-stdin
That adds quoting to the variables and a second dash to the long arg. It also assumes those variables are defined.
That said, I tend to use the following in GitHub Actions for doing the login:
​    - ​name​: ​Login to GHCR
​      ​uses​: ​docker/login-action#v1 
​      ​with​:
​        ​registry​: ​ghcr.io
​        ​username​: ​${{ secrets.GHCR_USERNAME }}
​        ​password​: ​${{ secrets.GHCR_TOKEN }}
Instead of using echo $CR_PAT | docker login ghcr.io -u $ghcr_user --password-stdin use
docker login ghcr.io -u $ghcr_user -p $CR_PAT

how to find image manifest of Fluentd docker image for AWS ecr put-image

Team,
I am trying to upload Fluentd image to AWS ecr and getting error.
I have below images and tagged.
docker images | grep fluent
123.dkr.ecr.us-west-1.amazonaws.com/sre-tools/fluentd-ds latest b285a4690f19 5 months ago 209MB
123.dkr.ecr.us-west-1.amazonaws.com/sre-tools/fluentd-ds v1.8 b285a4690f19 5 months ago 209MB
fluentd v1.8-debian-1 b285a4690f19 5 months ago 209MB
aws ecr put-image --repository-name sre-tools/fluentd-ds:v1.8
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument --image-manifest is required
from where should I get the image manifest? sorry this is my first time.
is manifest the sha256 of image? if yes I tried below
docker inspect b285a4690f19 | grep sha -i
"Id": "sha256:b285a4690f19ea48e817d0654df9d9225abb9c8ddb2fd3ffb9c1e00b3d7189ac",
"fluentd#sha256:a25d9ebbb344c40e1e84c173a466bc1f6e77a0233567fe778db1c6ffdeccf2e8"
"RUBY_DOWNLOAD_SHA256=d5d6da717fd48524596f9b78ac5a2eeb9691753da5c06923a6c31190abe01a62",
"Image": "sha256:66dc2c47c50cdf7f75ec68d1d027b4f139c4e5afcb2e0229ded10c659feafc43",
"RUBY_DOWNLOAD_SHA256=d5d6da717fd48524596f9b78ac5a2eeb9691753da5c06923a6c31190abe01a62",
"Image": "sha256:66dc2c47c50cdf7f75ec68d1d027b4f139c4e5afcb2e0229ded10c659feafc43",
"sha256:488dfecc21b1bc607e09368d2791cb784cf8c4ec5c05d2952b045b3e0f8cc01e",
"sha256:6bab58ebc554a7f95a80ee2dca3fbb05e05a5bceadab8b6d99d9eb41e0c7532f",
aws ecr put-image --repository-name sre-tools/fluentd-ds --image-manifest "sha256:a25d9ebbb344c40e1e84c173a466bc1f6e77a0233567fe778db1c6ffdeccf2e8"
An error occurred (InvalidParameterException) when calling the PutImage operation: Invalid parameter at 'ImageManifest' failed to satisfy constraint: 'Invalid JSON syntax'
I had to provide a json file and not direct input
aws ecr put-image --repository-name sre-tools/fluentd-ds --image-manifest manifest.json"
also, got a workaround by using docker cli instead
docker push sre-tools/fluentd-ds:v1

Resources