Creating the HTTP basic authentication file

Finally, regarding the HTTP basic authentication file, if you set up a private registry, authentication is needed when you interact with the Docker registry. You'll have to do docker login to get a token when pushing and pulling images. In order to create an HTTP basic authentication file, use the htpasswd command that is provided by Apache2 as this is easiest. Let's create a HTTP basic authentication file via the following steps:

  1. Run Docker with Apache2 Docker image (httpd) to run the htpasswd command with the bcrypt (-B) option and generate a basic authentication file (registry_passwd) under the secrets directory:
//set user=user01, passwd=my-super-secure-password
$ docker run -i httpd /bin/bash -c 'echo my-super-secure-password | /usr/local/apache2/bin/htpasswd -nBi user01' > secrets/registry_passwd
  1. Check the secrets directory so that now you have four files:
$ ls secrets/
domain.crt domain.key http.secret registry_passwd
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.70.170