docker-compose up doesn't pull down latest image if the image exists locally
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.
Is there a reason why docker-compose pull && docker-compose up is impractical?
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.
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).
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
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.
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 !
Any news about this?
Hi,
Any news about this issue?
+1
+1
As I mentioned earlier, docker-compose pull && docker-compose up is functionally identical. There's no good reason to add another flag for it.
Imagine that git didn't have pull because git fetch && git merge origin/master is functionally identical.
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.
+1
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.
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.
@shin- what about rethinking your decision on this? I believe comments and reactions to them look self-descriptive enough.
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.
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.
@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?