By default Compose pulls an image only if it is missing, so a stack can run an old image for months. The pull_policy attribute lets you decide how often it looks.
The container specification lists the values. always pulls every time, never relies on the cached image and reports a failure if there is none, and missing pulls only when the image is not in the cache. missing is the default when the build specification is not also used, and the latest tag is always pulled even with it. build makes Compose build the image, and rebuild it if it is already present.
Then the time-based ones: daily checks the registry if the last pull was more than 24 hours ago, weekly does the same with seven days, and every_<duration> takes your own. Units are weeks, days, hours, minutes and seconds (w, d, h, m, s), and they can be combined.
services:
app:
image: example/app:1.0
pull_policy: every_12h
I like daily for a pinned tag that the maintainer might rebuild with security fixes, since you get the new base image without ever typing pull.
The check happens when you run docker compose up, not in the background. Nothing watches the registry for you, so a stack that is never started or recreated never updates. Even when a new image is pulled, the running container only changes when Compose recreates it. A moving tag can still change your setup, so I would use this with version tags.
Further reading: Compose container specification: pull_policy