Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] docker compose up --watch with sync+restart ends up disconnecting from watch #12317

Open
torarnv opened this issue Nov 24, 2024 · 1 comment
Labels

Comments

@torarnv
Copy link

torarnv commented Nov 24, 2024

Description

Similar to #11773 I'm seeing docker compose up --watch disconnecting when the container is restarted:

❯ docker compose up --watch
[+] Running 1/0
 ✔ Container caddy-caddy-1  Running                                                        0.0s
        ⦿ Watch enabled
Attaching to caddy-1
         ⦿ Syncing and restarting service "caddy" after 1 changes were detected
caddy-1  | 2024/11/23 00:42:30.609	INFO	shutting down apps, then terminating	{"signal": "SIGTERM"}
caddy-1  | 2024/11/23 00:42:30.609	WARN	exiting; byeee!! 👋	{"signal": "SIGTERM"}
caddy-1  | 2024/11/23 00:42:30.609	INFO	http	servers shutting down with eternal grace period
caddy-1  | 2024/11/23 00:42:30.609	INFO	admin	stopped previous server	{"address": "localhost:2019"}
caddy-1  | 2024/11/23 00:42:30.609	INFO	shutdown complete	{"signal": "SIGTERM", "exit_code": 0}
         ⦿ service "caddy" restarted
caddy-1 exited with code 0
         ⦿ Syncing and restarting service "caddy" after 1 changes were detected
caddy-1  | 2024/11/23 00:42:39.434	INFO	shutting down apps, then terminating	{"signal": "SIGTERM"}
caddy-1  | 2024/11/23 00:42:39.434	WARN	exiting; byeee!! 👋	{"signal": "SIGTERM"}
caddy-1  | 2024/11/23 00:42:39.434	INFO	http	servers shutting down with eternal grace period
caddy-1  | 2024/11/23 00:42:39.434	INFO	admin	stopped previous server	{"address": "localhost:2019"}
caddy-1  | 2024/11/23 00:42:39.434	INFO	shutdown complete	{"signal": "SIGTERM", "exit_code": 0}
caddy-1 exited with code 0
         ⦿ Watch disabled

❯
services:
  caddy:
    image: torarnv/caddy
    build: .
    restart: unless-stopped
    ports:
      - "8080:80"

    develop:
      watch:
        - action: sync+restart
          path: ./Caddyfile
          target: /etc/caddy/Caddyfile

Likely because it temporarily sees that there are no services running.

Adding a keep-alive workaround service "fixes" the issue:

dummy-watch-workaround:
  image: alpine:latest
  init: true
  command: ["sh", "-c", "while true; do sleep 2; done"]

Compose Version

2.30.3

@ndeloof
Copy link
Contributor

ndeloof commented Nov 25, 2024

I tried to reproduce without success.

I'm using:

services:
  app1:
    build:
      dockerfile_inline: FROM nginx
    develop:
      watch:
        - action: sync+restart
          path: .
          target: /tmp

Can you please give it a try?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants