code: func createHtpasswdFile(path string) error {
  	if f, err := os.Open(path); err == nil {
  		f.Close()
  		return nil
  	} else if !os.IsNotExist(err) {
  		return err
  	}
  
  	if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil {
  		return err
  	}
  	f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0600)
  	if err != nil {
  		return fmt.Errorf("failed to open htpasswd path %s", err)
  	}
  	defer f.Close()
  	var secretBytes [32]byte
  	if _, err := rand.Read(secretBytes[:]); err != nil {
  		return err
  	}
  	pass := base64.RawURLEncoding.EncodeToString(secretBytes[:])
  	encryptedPass, err := bcrypt.GenerateFromPassword([]byte(pass), bcrypt.DefaultCost)
  	if err != nil {
  		return err
  	}
  	if _, err := f.Write([]byte(fmt.Sprintf("docker:%s", string(encryptedPass[:])))); err != nil {
  		return err
  	}
  	dcontext.GetLoggerWithFields(context.Background(), map[interface{}]interface{}{
  		"user":     "docker",
  		"password": pass,
  	}).Warnf("htpasswd is missing, provisioning with default user")
  	return nil
  }
docs: // createHtpasswdFile creates and populates htpasswd file with a new user in case the file is missing