I've a Makefile with:
docker build --build-arg USER=${USER} --build-arg PASSWD=${PASSWD}
and I build it in a jenkins script with:
withCredentials([usernamePassword(credentialsId: 'my-credentials', passwordVariable: 'PASSWD', usernameVariable: 'USER')]) { (build_step) }
In a Dockerfile script, I have:
ARG USER
ARG PASSWD
curl -u ${USER}:${PASSWD}
Where USER/PASSWD pair is passed to repo/API.
What are necessary steps for USER / PASSWD to be passed properly? I've tried a lot of solutions/syntax options and RUN export. None seems to be working.
Is there a way to RUN echo variables from dockerfile? Jenkins log shows either a variable name or whitespaces for most of attempts.
You can pass the arguments to dockerile using --build-arg
. So in this case you could run something like docker build --build-arg USER=${USER} --build-arg PASSWD=${PASSWD}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.