I am using dokploy to deploy docker containers, but when I try to deploy a latest version of a container its not working because its not fetching the latest image from the repository
My docker file
version: '3.9'
services:
backend:
image: registry.gitlab.com/my-repo/my-code:latest
container_name: backend
ports:
- 4000
environment:
NODE_ENV: development
restart: always
What I have already tried
- docker pull registry.gitlab.com/my-repo/my-code:latest && docker compose -p ecom-backend-z9r6tk -f docker-compose.yml up -d --build --remove-orphans
- docker compose -p ecom-backend-z9r6tk -f docker-compose.yml up -d --build --remove-orphans --pull
Hacks that are working but I don't want to use, I want to automate the process
Set pull_policy
to always
like this
version: '3.9'
services:
backend:
image: registry.gitlab.com/my-repo/my-code:latest
pull_policy: always
container_name: backend
ports:
- 4000
environment:
NODE_ENV: development
restart: always
and compose will pull the image when you do docker compose up
.
Documentation here.