Reputation: 21
I have a requirement of pulling the docker container images from private docker hub and pushing the images into ACR using devops and later deploying it in AKS. I am unable to find the exact tasks for fulfilling my requirement. Can this be done through DevOps
Upvotes: 0
Views: 1561
Reputation: 707
Everything you can do with bash commands, you can do it in the pipeline (I think that's what you mean when you say "through DevOps").
In this case you need two things:
For that to happen, since in your case both are private and you need to login to access it, you will need to basically:
Login in Docker Hub -> Pull the image -> Login in ACR -> Push the image
The commands for that to happen will be something around what is below:
Pulling the image:
echo ${DOCKER_HUB_PASSWORD} | docker login --username "${DOCKER_HUB_USERNAME}" --password-stdin
docker pull "${IMAGE_NAME}:${TAG}"
Pushing the image:
docker tag -t "${IMAGE_NAME}:${TAG}" "${AZURE_REGISTRY_URL}/${IMAGE_NAME}:${TAG}"
echo ${AZURE_REGISTRY_PASSWORD} | docker login "${AZURE_REGISTRY_URL}" --username "${AZURE_REGISTRY_USERNAME}" --password-stdin
docker push "${AZURE_REGISTRY_URL}/${IMAGE_NAME}:${TAG}"
I made this out of my mind so this might not be 100% accurate but that's the process.
Value examples for each variable:
Upvotes: 1