Skip to content

Commit b07079a

Browse files
committed
update docs
1 parent e3d9a35 commit b07079a

File tree

1 file changed

+37
-54
lines changed

1 file changed

+37
-54
lines changed

from-alpine-to-debian.md

Lines changed: 37 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -11,90 +11,70 @@ This document outlines the key differences between the Alpine and Debian variant
1111
| Package Manager | `apk` | `apt-get` |
1212
| Shell | `sh` (BusyBox) | `bash` |
1313
| Privilege Drop | `su-exec` | `gosu` |
14-
| Supervisord | ochinchina/supervisord (Go static binary) | Official supervisor package (Python) |
15-
| Architecture | amd64 only (nginx variants) | amd64 + arm64 |
14+
| Supervisord | Python supervisor (Alpine package) | Python supervisor (Debian package) |
15+
| Architecture | amd64 + arm64 | amd64 + arm64 |
1616
| glibc | musl libc | glibc |
1717

1818
## When to Use Debian
1919

2020
Choose the Debian variant when:
2121

22-
- **ARM64/Apple Silicon support is needed** - The Debian variant has native multi-arch support
2322
- **Compatibility issues with Alpine** - Some PHP extensions or native libraries may have issues with musl libc
2423
- **Debugging needs** - Debian includes more debugging tools out of the box
2524
- **Familiarity** - Teams more familiar with Debian/Ubuntu environments
25+
- **Native library compatibility** - Some C libraries behave differently with glibc vs musl
2626

2727
## When to Use Alpine
2828

2929
Choose the Alpine variant when:
3030

3131
- **Minimal image size is critical** - Alpine images are significantly smaller
3232
- **Security through minimalism** - Smaller attack surface with fewer packages
33-
- **amd64-only deployments** - No need for ARM64 support
33+
- **musl libc is acceptable** - Your application has no compatibility issues with musl
34+
35+
**Note:** Both Alpine and Debian variants now support multi-arch (amd64 + arm64).
3436

3537
## Key Differences in Detail
3638

3739
### 1. Supervisord Implementation
3840

39-
**Alpine** uses [ochinchina/supervisord](https://github.com/ochinchina/supervisord), a Go-based reimplementation:
41+
Both **Alpine** and **Debian** now use the official Python-based supervisord package (installed via `apk add supervisor` and `apt-get install supervisor` respectively). The configuration format is identical:
4042

4143
```ini
42-
# Alpine supervisor.conf
43-
[program:nginx]
44-
depends_on = php-fpm
45-
command = nginx -g "daemon off;"
46-
stopasgroup = true
47-
stderr_logfile = /dev/stderr
48-
stdout_logfile = /dev/stdout
44+
# supervisor.conf (both Alpine and Debian)
45+
[supervisord]
46+
logfile=/dev/stdout
47+
logfile_maxbytes=0
48+
pidfile=/run/supervisord.pid
49+
nodaemon=true
4950

5051
[program:php-fpm]
5152
command = php-fpm
53+
priority = 10
54+
autorestart = true
5255
stopasgroup = true
56+
killasgroup = true
5357
stderr_logfile = /dev/stderr
5458
stdout_logfile = /dev/stdout
55-
```
56-
57-
**Debian** uses the official Python-based supervisord package:
58-
59-
```ini
60-
# Debian supervisor.conf
61-
[supervisord]
62-
nodaemon=true
63-
user=root
64-
logfile=/dev/null
65-
logfile_maxbytes=0
66-
pidfile=/run/supervisord.pid
67-
68-
[program:php-fpm]
69-
command=php-fpm
70-
priority=10
71-
autostart=true
72-
autorestart=true
73-
stopasgroup=true
74-
killasgroup=true
75-
stdout_logfile=/dev/stdout
76-
stdout_logfile_maxbytes=0
77-
stderr_logfile=/dev/stderr
78-
stderr_logfile_maxbytes=0
59+
stderr_logfile_maxbytes = 0
60+
stdout_logfile_maxbytes = 0
7961

8062
[program:nginx]
81-
command=nginx -g "daemon off;"
82-
priority=20
83-
autostart=true
84-
autorestart=true
85-
stopasgroup=true
86-
killasgroup=true
87-
stdout_logfile=/dev/stdout
88-
stdout_logfile_maxbytes=0
89-
stderr_logfile=/dev/stderr
90-
stderr_logfile_maxbytes=0
63+
command = nginx -g "daemon off;"
64+
priority = 20
65+
autorestart = true
66+
stopasgroup = true
67+
killasgroup = true
68+
stderr_logfile = /dev/stderr
69+
stdout_logfile = /dev/stdout
70+
stderr_logfile_maxbytes = 0
71+
stdout_logfile_maxbytes = 0
9172
```
9273

93-
**Key differences:**
94-
- Alpine uses `depends_on` for process ordering
95-
- Debian uses `priority` (lower number starts first)
96-
- Debian requires a `[supervisord]` section with `nodaemon=true`
97-
- Debian needs `stdout_logfile_maxbytes=0` to disable log rotation for stdout/stderr
74+
**Key configuration points:**
75+
- `priority` controls startup order (lower number starts first)
76+
- `nodaemon=true` keeps supervisord in foreground
77+
- `stdout_logfile_maxbytes=0` disables log rotation for stdout/stderr
9878

9979
### 2. Entrypoint Script
10080

@@ -155,11 +135,14 @@ To migrate from Alpine to Debian:
155135
image: kooldev/php:8.4-debian-nginx
156136
```
157137
158-
2. **Custom supervisor configs:** If you've customized the supervisor configuration, update to use `priority` instead of `depends_on`
138+
2. **Shell scripts:** Update any scripts that use:
139+
- `su-exec` → `gosu`
140+
- BusyBox-specific commands → standard GNU coreutils
141+
- `sh` shebang → `bash` shebang (if using bash features)
159142

160-
3. **Shell scripts:** Update any scripts that rely on Alpine-specific paths or BusyBox commands
143+
3. **Test thoroughly:** The glibc vs musl difference can cause subtle behavior changes in some applications
161144

162-
4. **Test thoroughly:** The glibc vs musl difference can cause subtle behavior changes in some applications
145+
**Note:** Supervisor configuration format is now identical between Alpine and Debian, so no changes needed for custom supervisor configs.
163146

164147
## Available Debian Image Tags
165148

0 commit comments

Comments
 (0)