Example from my PHP Dockerfile:
# Install composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
With that, I would expect to have the latest composer version in my container. But I have some old versions. When I do docker images
I see that my composer:latest
image is outdated:
composer latest 8f2928e1f548 8 months ago 176MB
So what I do is:
docker-compose pull --include-deps
docker-compose up -d --build --remove-orphans
But, it only pulls the base images, not the ones I rely on via --from
.
Is there some option I oversee? Or should I just require some specific version like :2.0.13
? I’ve seen some blog posts about the :latest
tag being not what it suggests to be.
2
Answers
The problem with
:latest
tag is that it doesn’t really mean that you are pulling the last update of that image, just the one they tagged as:latest
.Many times it’s some versions outdated but it may be the last stable image, so it’s not a bad idea to use latest if you don’t have any preference on the version of the image.
First of all, you should understand that
--include-deps
works only for images that you set in thedepends_on
directive. Not for multistage.For your case, you probably should build your image without cache.
docker build --pull --no-cache --tag myimage:version .
before push to a repositoryor if you use build in your docker-compose file
docker-compose build --no-cache --pull