I followed this article Docker Registry to set up a restricted access docker registry. I don't understand the following snippet.
$ docker run \
--entrypoint htpasswd \
registry:2 -Bbn testuser testpassword > auth/htpasswd
I checked the docker official docker run document, but I didn't find the -Bbn reference.
What does -Bbn means?
Where can I find the document of -Bbn?
-Bbn are the arguments of htpasswd command (https://httpd.apache.org/docs/2.4/programs/htpasswd.html), which is specified in argument
--entrypoint htpasswd
The docker run command essentially runs the command below in the registry:2 Docker container
htpasswd -Bbn testuser testpassword
and then redirect the output the file auth/htpasswd in your local directory
Update: To run the command htpasswd -Bbn testuser testpassword > auth/htpasswd (with redirection) in the container. You can run it as a /bin/sh command instead with the redirection included
docker run \
registry:2 /bin/sh -c "htpasswd -Bbn testuser testpassword > auth/htpasswd"
If auth is not found in the directory, you can create it before running the htpasswd command
docker run \
registry:2 /bin/sh -c "mkdir -p auth && htpasswd -Bbn testuser testpassword > auth/htpasswd"
All docker args come before the image name; those args are for htpasswd, which is the .. yup, you guessed it, the “entry point”.
The htpasswd args mean use bcrypt, run in batch, use standard output.
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