Overview
- Full name
docker.io/nginx/unit- Registry
- docker.io
- Namespace
- nginx
- Repository
- unit
- Cached tags
- 316
- Last synced
- 07/06/2026, 02:06 PM
Introduction
Nginx Unit 动态应用服务器镜像,热加载 PHP/Python/Go 等语言模块,无需重载进程即可切换路由,适合多语言微服务网关。
Details
nginx/unit 是 Nginx 出品的轻量应用服务器,通过 REST API 或 JSON 配置动态加载 PHP、Python、Node 等模块并反向代理 upstream。与 nginx + php-fpm 双容器相比单进程管理更简单;典型用于边缘节点或需要频繁变更路由的内网 API。生产应固定 tag、持久化 /var/lib/unit 配置目录,并通过 TLS 终止层保护管理 API。
快速启动
docker run -d --name unit \
-p 8080:8080 \
-v $(pwd)/config:/docker-entrypoint.d \
docker.io/nginx/unit:latest
推荐实践
docker run -d --name unit \
--restart unless-stopped \
-p 8080:8080 -p 8443:8443 \
-v /data/unit/state:/var/lib/unit \
-v /data/unit/config:/docker-entrypoint.d \
-v /data/app:/www \
docker.io/nginx/unit:1.33.0
核心参数说明
-p 8080:8080— HTTP 监听端口-v .../state:...— Unit 运行时状态持久化-v .../config:...— 启动时加载的 JSON 配置-v .../app:...— 应用代码根目录--restart unless-stopped— 应用网关持续在线- 固定 tag — Unit 大版本 pin
Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-unit
spec:
replicas: 2
selector:
matchLabels:
app: nginx-unit
template:
metadata:
labels:
app: nginx-unit
spec:
containers:
- name: unit
image: docker.io/nginx/unit:1.33.0
ports:
- containerPort: 8080
volumeMounts:
- name: config
mountPath: /docker-entrypoint.d
- name: app
mountPath: /www
volumes:
- name: config
configMap:
name: unit-config
- name: app
persistentVolumeClaim:
claimName: unit-app
---
apiVersion: v1
kind: Service
metadata:
name: nginx-unit
spec:
selector:
app: nginx-unit
ports:
- port: 8080
targetPort: 8080
路由 JSON 经 ConfigMap 挂载;Ingress 暴露 8080,动态配置变更可通过 sidecar 调用 Unit API 或滚动更新 ConfigMap。
Latest tags (20)
View all 316 tags →| Tag | Arch | Pushed At | Size | Digest | Sync | Wish | Action |
|---|---|---|---|---|---|---|---|
docker.io/nginx/unit :1.29.1-minimal | linux/amd64 | 2023/03/01 04:59 | 34.4 MB | sha256:7207f265f485… | |||
docker.io/nginx/unit :1.29.1-ruby3.1 | linux/amd64 | 2023/03/01 04:59 | 343.9 MB | sha256:f6b036946f94… | |||
docker.io/nginx/unit :1.29.1-python3.11 | linux/amd64 | 2023/03/01 04:59 | 341.9 MB | sha256:d8790e09e0f6… | |||
docker.io/nginx/unit :1.29.1-php8.1 | linux/amd64 | 2023/03/01 04:59 | 165.3 MB | sha256:3d9f40cae27c… | |||
docker.io/nginx/unit :1.29.1-perl5.36 | linux/amd64 | 2023/03/01 04:59 | 327.1 MB | sha256:63d7ab379257… | |||
docker.io/nginx/unit :1.29.1-node18 | linux/amd64 | 2023/03/01 04:59 | 358.4 MB | sha256:179c494f5c1a… | |||
docker.io/nginx/unit :1.29.1-jsc11 | linux/amd64 | 2023/03/01 04:58 | 240.9 MB | sha256:833aa9f720a3… | |||
docker.io/nginx/unit :1.29.1-go1.19 | linux/amd64 | 2023/03/01 04:58 | 348.2 MB | sha256:0635ab758a98… | |||
docker.io/nginx/unit :1.29.0-minimal | linux/amd64 | 2022/12/16 04:25 | 34.2 MB | sha256:878eeccc0dae… | |||
docker.io/nginx/unit :1.29.0-ruby3.1 | linux/amd64 | 2022/12/16 04:25 | 342.2 MB | sha256:00cb5f5c023b… | |||
docker.io/nginx/unit :1.29.0-python3.11 | linux/amd64 | 2022/12/16 04:25 | 342.2 MB | sha256:80cec6415a3b… | |||
docker.io/nginx/unit :1.29.0-php8.1 | linux/amd64 | 2022/12/16 04:25 | 164.6 MB | sha256:4ce4b60a5a3c… | |||
docker.io/nginx/unit :1.29.0-perl5.36 | linux/amd64 | 2022/12/16 04:25 | 325.4 MB | sha256:e15d93a7c5dd… | |||
docker.io/nginx/unit :1.29.0-node18 | linux/amd64 | 2022/12/16 04:25 | 355.9 MB | sha256:bfd084131f17… | |||
docker.io/nginx/unit :1.29.0-jsc11 | linux/amd64 | 2022/12/16 04:25 | 240.1 MB | sha256:597bb65d65c4… | |||
docker.io/nginx/unit :1.29.0-go1.19 | linux/amd64 | 2022/12/16 04:24 | 347.2 MB | sha256:fa1fccfc1f23… | |||
docker.io/nginx/unit :1.28.0-minimal | linux/amd64 | 2022/09/13 19:50 | 34.3 MB | sha256:661325bc628f… | |||
docker.io/nginx/unit :1.28.0-ruby3.1 | linux/amd64 | 2022/09/13 19:49 | 354.5 MB | sha256:b34f3c26bd69… | |||
docker.io/nginx/unit :1.28.0-python3.10 | linux/amd64 | 2022/09/13 19:47 | 351.6 MB | sha256:d9ad5d76f962… | |||
docker.io/nginx/unit :1.28.0-php8.1 | linux/amd64 | 2022/09/13 19:46 | 173.9 MB | sha256:e612c94fc24d… |