wowu / docker-rollout

🚀 Zero Downtime Deployment for Docker Compose
https://github.com/Wowu/docker-rollout
MIT License
2.37k stars 66 forks source link

Remanining containers after rollout #25

Open rap2hpoutre opened 7 months ago

rap2hpoutre commented 7 months ago

My deploy script (sh file) build three images and rollout:

git pull

docker compose build dashboard
docker compose build api
docker compose build website

docker rollout dashboard
docker rollout api
docker rollout website

Sometimes (and I don't know why) there are "remaining" containers after a deployment:

CONTAINER ID   IMAGE                    COMMAND                  CREATED         STATUS         PORTS                NAMES
123026510d16   myapp-website             "docker-entrypoint.s…"   6 minutes ago   Up 6 minutes   8080/tcp             myapp-website-50
123b6fdc1486   myapp-api                 "docker-entrypoint.s…"   6 minutes ago   Up 6 minutes   3000/tcp             myapp-api-55
12332ab4c312   myapp-api                 "docker-entrypoint.s…"   6 minutes ago   Up 6 minutes   3000/tcp             myapp-api-54
123b3f057175   myapp-api                 "docker-entrypoint.s…"   6 minutes ago   Up 6 minutes   3000/tcp             myapp-api-56
123e6157eca8   myapp-api                 "docker-entrypoint.s…"   7 minutes ago   Up 7 minutes   3000/tcp             myapp-api-53
1234a67df563   myapp-dashboard           "docker-entrypoint.s…"   7 minutes ago   Up 7 minutes   8083/tcp             myapp-dashboard-48
12315fea426f   nginxproxy/nginx-proxy   "/app/docker-entrypo…"   2 weeks ago     Up 2 weeks     0.0.0.0:80->80/tcp   myapp-nginx-proxy-1

I have no idea why it's happening.

wowu commented 7 months ago

Can you share the docker compose file?

rap2hpoutre commented 7 months ago

@Wowu Thanks for your answer. The repository is open-source, here is the docker compose file: https://github.com/mano-sesan/mano/blob/8e8876f442976eb3ac15775d2e6a94ebe788100a/docker-compose.yml

wowu commented 7 months ago

I think you need to change restart: always to restart: unless-stopped, because your containers are restarted when docker-rollout tries to stop them.

restart: unless-stopped gives you the same auto healing behavior as restart: always.

NiklasPor commented 7 months ago

I'm also running into this with restart: unless-stopped when the process dies while running docker rollout.

To replicate:

As this is a rather simple script, I'm not sure whether this is really fixable?