问题
I have docker-compose.yml
file present in the repository. I have added the image attribute in one of the services to pull the docker images. I have not hard coded the docker image and docker tag and planning to pass these arguments at the runtime to docker-compose.yml
file.
How to pass the runtime arguments like IMAGE_TAG=82
, IMAGE_NAME=app1
to the docker-compose.yml
file?
回答1:
You can use variables in the docker-compose file for the image & tag:
version: '3'
services:
redis-server:
image: ${IMAGE_NAME}:${IMAGE_TAG}
And pass the arguments in the docker-compose task:
You can also define pipeline variables and check the "Settable at release time":
So when you click on "Create Release" you can replace the values:
来源:https://stackoverflow.com/questions/60428499/how-to-provide-docker-image-tag-dynamically-to-docker-compose-yml-in-azure-relea