compose icon indicating copy to clipboard operation
compose copied to clipboard

docker-compose up doesn't pull down latest image if the image exists locally

Open nrktkt opened this issue 10 years ago • 65 comments

It would be nice if there were an option to check for new versions of images when running docker-compose up.

We already have this functionality with docker build --pull as was discussed here https://github.com/docker/docker/issues/4238 and there is an open issue to bring --pull to docker run here https://github.com/docker/docker/issues/13331.

I propose adding --pull to up to always attempt to pull a newer version of the images in the compose file.

nrktkt avatar Jun 09 '16 17:06 nrktkt

Is there a reason why docker-compose pull && docker-compose up is impractical?

shin- avatar Jun 09 '16 22:06 shin-

I think most of the points for/against are the same as the ones discussed in the issue for adding --pull to docker run. They range from ux and consistency, to ease of scripting/workflow, to swarm integration (out of curiosity, what does docker-compose pull do with swarm?). I don't think it's a major issue, but something to consider. The same type of users who desired the feature elsewhere would likely also enjoy it here.

nrktkt avatar Jun 09 '16 23:06 nrktkt

I'm trying to execute "docker-compose build", but it doesn't refresh the image referenced in the Dockerfile, except when you use --pull.

You can also build containers during the start with up --build. But the newest images will not be pulled. Can we expect sthg like "docker-compose up --build --pull" (or similar)? Maybe it makes sense to place it in the YML since not all build must be refreshed (cfr. local images).

decoomanj avatar Jun 30 '16 10:06 decoomanj

Instead of (or in addition to) adding --pull to the cli, what about adding something on the service definition in the docker-compose file?, e.g.

version: '2'

services:

  postgres:
    image: postgres
    container_name: postgres
    pull: true
    ports:
     - '5432:5432'

This way if there's a service I don't care about being latest and one I do, docker-compose won't waste time downloading images I'm not interested in

cressie176 avatar Oct 11 '16 09:10 cressie176

I came here looking for this feature because we use it in our production cluster of Kubernetes. There the tag is "imagePullPolicy" and it can be set to "IfNotPresent", "Always", or "Never." Something similar for a compose environment would be nice.

blockloop avatar Feb 13 '17 17:02 blockloop

In our case, we need to rebuild base image everyday to make sure the latest dependencies updated for applications. Docker compose up to pull the latest image with the same tag is a nice feature. Why not !

PengBAI avatar Mar 03 '17 12:03 PengBAI

Any news about this?

marcelovcpereira avatar Mar 22 '17 15:03 marcelovcpereira

Hi,

Any news about this issue?

sugun999 avatar May 12 '17 11:05 sugun999

+1

jonathan-kosgei avatar May 14 '17 07:05 jonathan-kosgei

+1

draketribe avatar May 23 '17 13:05 draketribe

As I mentioned earlier, docker-compose pull && docker-compose up is functionally identical. There's no good reason to add another flag for it.

shin- avatar May 23 '17 16:05 shin-

Imagine that git didn't have pull because git fetch && git merge origin/master is functionally identical.

blockloop avatar May 23 '17 18:05 blockloop

Adding a pull: true tag could be useful for example if some of the images you use in your compose file are in your cache. docker-compose pull pull all of the images in your compose file, and that pull will fail if these images are in your cache but not in the repository.

Amvoled avatar Jun 08 '17 07:06 Amvoled

+1

fulllove890 avatar Jun 12 '17 03:06 fulllove890

One scenario in which docker-compose pull && docker-compose up becomes impractical is when you're using multiple docker-compose files. You can easily end up with a command like docker-compose -f docker-compose.test.yml pull && docker-compose -f docker-compose.test.yml up.

JustinLivi avatar Jun 23 '17 21:06 JustinLivi

We have a scenario in which we develop locally and we would only want to pull some of the images from remote. The one (or more) developed locally should remain untouched. In that case we are obligated to build/pull images manually before running docker-compose up. A pull: true would be beneficial.

xellsys avatar Jul 12 '17 12:07 xellsys

@shin- what about rethinking your decision on this? I believe comments and reactions to them look self-descriptive enough.

lig avatar Jul 25 '17 14:07 lig

No, I'm good. This is an open-source project, if you disagree with the conservative approach we take when adding features, you're welcome to fork it.

shin- avatar Jul 25 '17 20:07 shin-

Agree on adding either a flag to the docker-compose up command or a parameter to the configuration. We use a base image with additional configuration that tends to change frequently during the development process. We want to create a fool-proof environment, where a developer can simply run docker-compose up without debugging what they don't need to debug.

I actually hit this thread after my colleague was checking my pull request and said it broke the build. And the reason being is that the base image was simply missing a couple of packages - but got executed in the final Dockerfile. It would be a good feature, but apparently not something you used, @shin- .

We'd be happy if you introduce this feature in the new version.

alwye avatar Oct 06 '17 16:10 alwye

@shin- I think @blockloop showed with the git example how convenient / useful the pull option is. Honestly I hope for such things it is not necessary to fork any project.

I totally understand the conservative approach but it feels like it is not even considered as an option anymore. Maybe it can be part of an upcoming version?

kgalli avatar Oct 19 '17 06:10 kgalli