最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

docker - deploy latest container in dokploy - Stack Overflow

programmeradmin2浏览0评论

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
Share Improve this question asked Jan 18 at 12:08 Ankit HalderAnkit Halder 1691 gold badge4 silver badges18 bronze badges 1
  • can you just set the 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
Add a comment  | 

1 Answer 1

Reset to default 2

Set 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.

发布评论

评论列表(0)

  1. 暂无评论