How to provide docker image tag dynamically to docker-compose.yml in Azure Release Pipeline Task?

冷暖自知 提交于 2021-01-29 19:30:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!