2

I need to add a repository using zypper that requires authentication from a Dockerfile. I'm able to add it, but of course, when I try to run

zypper -n refresh

It fails because the authentication failed.

What is the normal approach to automate the authentication process? Didn't find a good answer while "googling".

amp
  • 11,754
  • 18
  • 77
  • 133

1 Answers1

2

Solved it like this:

Dockerfile

ARG MY_REPO_USERNAME
ARG MY_REPO_PASSWORD

RUN zypper -n addrepo https://$MY_REPO_USERNAME:$MY_REPO_PASSWORD@repo.domain/foo/bar repo-domain-alias

When building the image:

docker build --build-arg MY_REPO_USERNAME=my_username --build-arg MY_REPO_PASSWORD=my_password -tag my-image-name .
amp
  • 11,754
  • 18
  • 77
  • 133