compose icon indicating copy to clipboard operation
compose copied to clipboard

[BUG] pull_policy

Open rubixvi opened this issue 3 weeks ago • 7 comments

Description

pull_policy: always

Reference: https://github.com/Dokploy/dokploy/issues/3127

Pull policy doesn't check for latest image when :latest or :alpine tags are being used.

Docker Environment

Docker 29.0.2
Ubuntu 25.10

rubixvi avatar Dec 07 '25 06:12 rubixvi

Please provide compose version in use as requested on issue template

Regarding this issue, please confirm docker pull <image> detects a new image is available for target reference, while docker compose pull didn't

ndeloof avatar Dec 07 '25 20:12 ndeloof

Updated with the docker image.

name: usesend-prod

services:
  usesend-db-prod:
    image: postgres:17-alpine
    restart: always
    environment:
      - POSTGRES_USER=${POSTGRES_USER:?err}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?err}
      - POSTGRES_DB=${POSTGRES_DB:?err}
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
      interval: 10s
      timeout: 5s
      retries: 5
    # ports:
    #   - "5432:5432"
    volumes:
      - usesend-db:/var/lib/postgresql/data

  usesend-redis-prod:
    image: redis:alpine
    restart: always
    # ports:
    #   - "6379:6379"
    volumes:
      - cache:/data
    command: ["redis-server", "--maxmemory-policy", "noeviction"]

  usesend-storage-prod:
    image: minio/minio:latest
    pull_policy: always
    ports:
      - 9002
      - 9001
    volumes:
      - storage:/data
    environment:
      MINIO_ROOT_USER: usesend
      MINIO_ROOT_PASSWORD: password
    entrypoint: sh
    command: -c 'mkdir -p /data/usesend && minio server /data --console-address ":9001" --address ":9002"'

  usesend:
    image: usesend/usesend:latest
    pull_policy: always
    restart: always
    ports:
      - ${PORT:-3000}
    environment:
      - PORT=${PORT:-3000}
      - DATABASE_URL=${DATABASE_URL}
      - NEXTAUTH_URL=${NEXTAUTH_URL}
      - NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
      - AWS_ACCESS_KEY=${AWS_ACCESS_KEY}
      - AWS_SECRET_KEY=${AWS_SECRET_KEY}
      - AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}
      - GITHUB_ID=${GITHUB_ID}
      - GITHUB_SECRET=${GITHUB_SECRET}
      - REDIS_URL=${REDIS_URL}
      - NEXT_PUBLIC_IS_CLOUD=${NEXT_PUBLIC_IS_CLOUD:-false}
      - API_RATE_LIMIT=${API_RATE_LIMIT:-1}
    depends_on:
      usesend-db-prod:
        condition: service_healthy
      usesend-redis-prod:
        condition: service_started

volumes:
  usesend-db:
  cache:
  storage:

Here's a simple one, anything with :latest will reuse old image without checking for new image and won't pull.

rubixvi avatar Dec 08 '25 13:12 rubixvi

I can't reproduce.

$ docker compose --progress=plain up
 Image xx Pulling 
 Image xx Pulled 

please confirm docker pull <image> detects a new image is available for target reference, while docker compose up doesn't

ndeloof avatar Dec 08 '25 14:12 ndeloof

It pulls the new image, but docker compose is indeed, reusing the older image.

rubixvi avatar Dec 08 '25 17:12 rubixvi

Do you mean compose is still using the older image even after docker pull pulled an updated one ?

ndeloof avatar Dec 08 '25 18:12 ndeloof

usesend: image: usesend/usesend:latest pull_policy: always restart: always

it'll pull the image and redeploy with the image is was on, rather than using the pulled image.

rubixvi avatar Dec 09 '25 00:12 rubixvi

I tried to reproduce without success. Image is already checked for update and replaced if a new build updated tag:

$ docker build -t nicolasdeloof582/test:latest --push .
[+] Building 5.1s (8/8) FINISHED                                     
...
$ docker compose up -d
[+] up 2/2
 ✔ Image nicolasdeloof582/test:latest Pulled                                                                                                                                                                                                  1.1s 
 ✔ Container truc-usesend-1           Recreated          

ndeloof avatar Dec 09 '25 06:12 ndeloof