feat: Add configurable restart policy, default to on-failure

- Changed restart policy from unless-stopped to on-failure
  so Windows shutdown stops the container instead of restarting
- Added RESTART_POLICY env variable to .env.modern and .env.legacy
- Compose files use ${RESTART_POLICY:-on-failure} for flexibility
- Updated WINCTL_GUIDE.md with restart policy documentation
- Updated readme.md with RESTART_POLICY setting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Michel Abboud 2026-01-29 00:46:11 +00:00
parent 5b274afbba
commit 23cc434703
21 changed files with 43 additions and 22 deletions

View File

@ -21,4 +21,5 @@
# HEIGHT=720 # Display height
# DHCP=N # Use DHCP (Y/N)
# SAMBA=Y # Enable file sharing (Y/N)
# RESTART_POLICY=on-failure # Restart policy (no, on-failure, always, unless-stopped)
# DEBUG=N # Debug mode (Y/N)

View File

@ -22,5 +22,8 @@ HEIGHT=720
DHCP=N
SAMBA=Y
# Restart Policy (no, on-failure, always, unless-stopped)
RESTART_POLICY=on-failure
# Debug
DEBUG=N

View File

@ -22,5 +22,8 @@ HEIGHT=720
DHCP=N
SAMBA=Y
# Restart Policy (no, on-failure, always, unless-stopped)
RESTART_POLICY=on-failure
# Debug
DEBUG=N

View File

@ -410,6 +410,7 @@ REGION=en-US
KEYBOARD=en-US
DHCP=N
SAMBA=Y
RESTART_POLICY=on-failure
DEBUG=N
```
@ -429,8 +430,20 @@ DEBUG=N
| `HEIGHT` | Display height | 720 |
| `DHCP` | Use DHCP networking | N |
| `SAMBA` | Enable file sharing | Y |
| `RESTART_POLICY` | Container restart policy | on-failure |
| `DEBUG` | Debug mode | N |
### Restart Policy Options
| Value | Description |
|-------|-------------|
| `no` | Never restart automatically |
| `on-failure` | Restart only if container exits with error (default) |
| `always` | Always restart regardless of exit status |
| `unless-stopped` | Always restart unless manually stopped |
**Note:** With `on-failure` (default), shutting down Windows from inside will stop the container. With `unless-stopped` or `always`, the container will restart after Windows shutdown.
---
## Interactive Menus

View File

@ -16,7 +16,7 @@ services:
- 3310:3389/udp
volumes:
- ../../data/win10:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m
win10e:
@ -36,7 +36,7 @@ services:
- 3314:3389/udp
volumes:
- ../../data/win10e:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m
win10l:
@ -56,5 +56,5 @@ services:
- 3315:3389/udp
volumes:
- ../../data/win10l:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,7 +16,7 @@ services:
- 3311:3389/udp
volumes:
- ../../data/win11:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m
win11e:
@ -36,7 +36,7 @@ services:
- 3312:3389/udp
volumes:
- ../../data/win11e:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m
win11l:
@ -56,5 +56,5 @@ services:
- 3313:3389/udp
volumes:
- ../../data/win11l:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,7 +16,7 @@ services:
- 3307:3389/udp
volumes:
- ../../data/win7:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m
win7e:
@ -36,5 +36,5 @@ services:
- 3371:3389/udp
volumes:
- ../../data/win7e:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,7 +16,7 @@ services:
- 3308:3389/udp
volumes:
- ../../data/win81:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m
win81e:
@ -36,5 +36,5 @@ services:
- 3381:3389/udp
volumes:
- ../../data/win81e:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3306:3389/udp
volumes:
- ../../data/vista:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3300:3389/udp
volumes:
- ../../data/win2k:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3305:3389/udp
volumes:
- ../../data/winxp:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3303:3389/udp
volumes:
- ../../data/win2003:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3208:3389/udp
volumes:
- ../../data/win2008:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3212:3389/udp
volumes:
- ../../data/win2012:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3316:3389/udp
volumes:
- ../../data/win2016:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3319:3389/udp
volumes:
- ../../data/win2019:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3322:3389/udp
volumes:
- ../../data/win2022:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3325:3389/udp
volumes:
- ../../data/win2025:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3110:3389/udp
volumes:
- ../../data/tiny10:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -16,5 +16,5 @@ services:
- 3111:3389/udp
volumes:
- ../../data/tiny11:/storage
restart: unless-stopped
restart: ${RESTART_POLICY:-on-failure}
stop_grace_period: 2m

View File

@ -136,6 +136,7 @@ DISK_SIZE=128G
USERNAME=docker
PASSWORD=admin
LANGUAGE=en
RESTART_POLICY=on-failure # Options: no, on-failure, always, unless-stopped
```
> 📖 See [WINCTL_GUIDE.md](WINCTL_GUIDE.md) for complete documentation, usage scenarios, and troubleshooting.