Brandon Squires
Brandon Squires

Reputation: 43

Can you specify the tag to pull when doing a docker-compose pull?

I have a docker-compose.yml file that kind of looks like this:

version: '3.5'
services:
  service1:
    image:service-one-image:develop

I know that develop is the specified tag that will be pulled if I do a docker-compose pull. But I would like to be able to pull a different tag without having the change every tag (they're all develop, so I could do a find and replace) in the yml file each time I need to switch tags. Is there a way to do that? Like a docker-compose pull --tag=release

Upvotes: 1

Views: 1539

Answers (1)

Brandon Squires
Brandon Squires

Reputation: 43

This is possible! I found an answer here

Basically you change the compose file to have a variable

version: '3.5'
services:
  service1:
    image:service-one-image:$TAG

And on the command line you run TAG={value} docker-compose {command}

Upvotes: 2

Related Questions