amp
amp

Reputation: 12372

Zypper repository authentication (non-interactive)

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".

Upvotes: 2

Views: 2049

Answers (1)

amp
amp

Reputation: 12372

Solved it like this:

Dockerfile

ARG MY_REPO_USERNAME
ARG MY_REPO_PASSWORD

RUN zypper -n addrepo https://$MY_REPO_USERNAME:[email protected]/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 .

Upvotes: 2

Related Questions