Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does "-Bbn" means in Docker?

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.

Question

What does -Bbn means?

Where can I find the document of -Bbn?

like image 613
David Avatar asked Oct 23 '25 11:10

David


2 Answers

-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" 
like image 68
VietHTran Avatar answered Oct 26 '25 01:10

VietHTran


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.

like image 24
user2864740 Avatar answered Oct 26 '25 02:10

user2864740