Skip to content

how to build a docker image with private reigistry image ? #12580

Closed Answered by chadlwilson
zszen asked this question in Q&A
Discussion options

You must be logged in to vote

Please use https://github.com/gocd/gocd/discussions or https://groups.google.com/g/go-cd for general usage questions rather than creating "issues".

This is really a general Docker configuration question rather than specific to GoCD. You could change your agent to be pre-logged in to your registry before it runs any jobs, or alternatively if you want to keep it dynamic for each pipeline:

Change your deal.sh to something like this

#!/usr/bin/env bash
TAG=test-`date +%y%m%d`
REGISTRY=10.0.33.251:5001
IMG=${REGISTRY}/nacos:${TAG}
echo "${DOCKER_REGISTRY_PASSWORD}" | docker login ${REGISTRY} --username "${DOCKER_REGISTRY_USERNAME}" --password-stdin
docker build -f dockerfile.df -t ${IMG} .
doc…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by zszen
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #12579 on March 06, 2024 07:56.