Docker login failing (at most 1 argument)

Viewed 9750

I am failing to login to a remote docker registry using a command of the form:

docker login –u my-username –p my-password registry.myclient.com

The error I get is the following:

"docker login" requires at most 1 argument.
See 'docker login --help'.

Usage:  docker login [OPTIONS] [SERVER]

How can login to the remote registry?

3 Answers

You don't have tacks in front of your options, it's some other dash like character. Try this instead:

docker login -u my-username -p my-password registry.myclient.com

While it looks similar, -u and -p are not the same as –u and –p.

This one worked for me if ci environment is in play:

echo ${MVN_PASSWORD} | docker login -u ${MVN_USER} --password-stdin ${MVN_URL}

these variables need to be set up via Settings > CI/CD > Variables (gitlabci example)

Here is what worked for me:

I saved the password in a file called my_password.txt.

Then, I ran the following command:

cat ~/my_password.txt | docker login -u AWS --password-stdin https://{YOUR_AWS_ACCOUNT_ID}.dkr.ecr.{YOUR_AWS_REGION}.amazonaws.com
Related