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/my-repo/my-code:latest
container_name: backend
ports:
- 4000
environment:
NODE_ENV: development
restart: always
What I have already tried
- deploy/Rebuild button in dokploy dashboard of container
- Stop then Start the service from dokploy dashboard
- Advance Setting in dokploy dahboard with commands
- docker pull registry.gitlab/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
- If I change the image tag from latest to a specify number while building the image and docker compose file everytime I publish a new version its working fine
- SSH into server and manually pull the latest image
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/my-repo/my-code:latest
container_name: backend
ports:
- 4000
environment:
NODE_ENV: development
restart: always
What I have already tried
- deploy/Rebuild button in dokploy dashboard of container
- Stop then Start the service from dokploy dashboard
- Advance Setting in dokploy dahboard with commands
- docker pull registry.gitlab/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
- If I change the image tag from latest to a specify number while building the image and docker compose file everytime I publish a new version its working fine
- SSH into server and manually pull the latest image
1 Answer
Reset to default 2Set pull_policy
to always
like this
version: '3.9'
services:
backend:
image: registry.gitlab/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.
image:pull_policy
to always so it will pull latest every time docs.gitlab/ee/ci/yaml/#imagepull_policy – Chris Doyle Commented Jan 18 at 12:14