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?
The most common reason for “Docker build Requires 1 Argument” error is when we try to build the image without providing sufficient arguments. Here, in the arguments, we need to provide the directory with the command.
The default user in a Dockerfile is the user of the parent image. For example, if your image is derived from an image that uses a non-root user example: swuser , then RUN commands in your Dockerfile will run as swuser .
Using STDIN prevents the password from ending up in the shell's history, or log-files. The following example reads a password from a file, and passes it to the docker login command using STDIN : $ cat ~/my_password.txt | docker login --username foo --password-stdin.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With