omiid
homenotebookai usage

Docker Compose won't pull the latest image unless you tell it to

June 11, 2024 · Updated on August 09, 2026

docker compose up recreates a container when your config changes, but it does not always pull the latest image first. If the tag already exists locally, Compose reuses the cached copy.

I hit this while building the image in CI, publishing it to a registry, and expecting Compose to fetch the newest version on the next docker compose up. It recreated the container and kept running the old local image. The missing piece was pull_policy.

I write short, practical notes like this one. Get the next one by email:

Unsubscribe anytime.

Compose reuses the cached image instead of checking the registry

By default, Compose does not pull a fresh image before starting your services.

If the image already exists locally, Compose keeps using that cached copy. That is fine when you build locally or want faster startup times. It is wrong when the image is produced elsewhere and republished under the same tag.

In other words, docker compose up recreating a container does not mean Compose will pull a new image from the registry first.

Set pull_policy: always to make Docker Compose pull the latest image

Docker Compose exposes this as pull_policy, set per service in the Compose file.

To make Docker Compose always pull the latest image from the registry, set it to always:

services:
  app:
    image: ghcr.io/your-org/your-app:main
    pull_policy: always

After adding that, rerunning docker compose up pulls the image again before starting the container.

always is one of four values. missing is the default and pulls only when the image is absent locally. never fails instead of pulling, which is what you want for offline or air-gapped runs. build rebuilds from the Dockerfile. The docs list all of them in the Compose file reference.

Use it when the image is built somewhere other than your machine

This is especially handy when:

  • the image is built in CI instead of on your machine
  • you publish a new image under the same tag
  • you want docker compose up to behave more like "use the latest remote image" than "reuse whatever is already cached locally"

If you only need to force a pull occasionally, do it as a one-off from the command line:

docker compose up --pull always

But if this is your normal workflow, putting pull_policy: always in the Compose file is nicer because you do not have to remember the flag every time.

Join My Newsletter

Occasional notes on software, tools, and things I learn. No spam.

Unsubscribe anytime.

Continue Reading
  • Tuning Postgres and pgvector: the three knobs that matter08-18-2026 · Most pgvector performance problems come down to three settings. This post shows how to read an ANN query plan and tune ef_search, shared_buffers, and work_mem in the right order.
  • HNSW vs IVFFlat: choosing and building your pgvector index08-14-2026 · Past a few hundred thousand rows, an exact scan stops being fast enough. Here is how to pick between HNSW and IVFFlat and build the index without locking the table.
  • Vector search relevance: chunking, metadata, and the 0.81 problem08-11-2026 · Most bad vector search results come from one of three failure modes: chunking, modality mismatch, or a confused model. Each one has a specific diagnostic and a specific fix.
  • pgvector setup: your first multimodal query in TypeScript08-03-2026 · One Postgres table can hold text and screenshot embeddings in the same vector column. This post sets up the schema, the Voyage embedding call, and the first query that returns both.
  • Vector search in Postgres: the mental model behind pgvector08-02-2026 · A first similarity query that returns results is not a finished search feature. This post explains what an embedding is, why one Postgres column can hold text and images, and where an untuned index starts returning wrong results.