Angie Docker 镜像#
要在 Docker 容器中运行 Angie,请使用我们注册表中的镜像:docker.angie.software
。它们基于我们的 二进制包 和几个操作系统的官方基础镜像构建。
备注
另请注意 Docker 模块,它实现了基于 Docker 容器标签动态更新上游服务器组。
最小镜像#
angie:minimal
: 基于 Alpine 3.21 的版本 1.10.1。angie:<VERSION>-minimal
: 基于 Alpine 3.21 的指定版本。
这些镜像仅包含 angie
包。
模板化镜像#
angie:templated
: 基于 Alpine 3.21 的版本 1.10.1。angie:<VERSION>-templated
: 基于 Alpine 3.21 的指定版本。
这些镜像设置以下环境变量:
ENV ANGIE_BINARY="angie"
ENV ANGIE_CONFIG_TEMPLATE="/etc/angie/angie.conf.t"
ENV ANGIE_ERROR_LOG_SEVERITY="notice"
ENV ANGIE_FEATURE_RELOAD="on"
ENV ANGIE_FEATURE_TEMPLATE="on"
ENV ANGIE_LOAD_MODULES=""
ENV ANGIE_PID_FILE="/run/angie/angie.pid"
ENV ANGIE_WORKER_CONNECTIONS="65536"
ENV ANGIE_WORKER_RLIMIT_NOFILE="65536"
这些变量可以用于自定义容器的行为:
ANGIE_BINARY
: 允许运行 调试版本。ANGIE_ERROR_LOG_SEVERITY
: 设置主 错误日志 文件的严重性级别。ANGIE_LOAD_MODULES
: 加载一个或多个可用模块(所有模块均包含在镜像中)。指定 一个不带空格的逗号分隔模块列表。ANGIE_PID_FILE
: 设置进程标识符(PID)文件的替代位置。ANGIE_FEATURE_TEMPLATE
: 在容器启动时使用 gomplate 工具生成 Angie 配置。 使用的参数:--input-dir /etc/angie/templates
和--output-dir /etc/angie
。ANGIE_FEATURE_RELOAD
: 启用对SIGHUP
、SIGQUIT
和SIGTERM
信号的处理。
示例#
模板化镜像中使用的配置大致应用变量如下:
...
{{- if has $modules "zstd"}}
# package: angie-module-zstd
load_module modules/ngx_http_zstd_filter_module.so;
load_module modules/ngx_http_zstd_static_module.so;
{{end}}
user angie;
worker_processes auto;
worker_rlimit_nofile {{.Env.ANGIE_WORKER_RLIMIT_NOFILE}};
error_log /var/log/angie/error.log {{.Env.ANGIE_ERROR_LOG_SEVERITY}};
pid {{.Env.ANGIE_PID_FILE}};
events {
worker_connections {{.Env.ANGIE_WORKER_CONNECTIONS}};
}
http {
include /etc/angie/mime.types;
default_type application/octet-stream;
log_format main ...
运行带有 shell 访问的容器:
$ docker run -it --pull always --rm --entrypoint=sh \
docker.angie.software/angie:templated
使用自定义连接参数和模块运行 Angie (命令 angie -T 将输出完整配置):
$ docker run -it --rm -e ANGIE_WORKER_CONNECTIONS=4 \
-e ANGIE_LOAD_MODULES="auth-jwt,vod" \
docker.angie.software/angie:templated angie -T
启动一个具有指定名称和额外模块的容器:
$ docker run -it --rm --name angie-test \
-e ANGIE_WORKER_CONNECTIONS=4 \
-e ANGIE_LOAD_MODULES="auth-jwt,vod" \
docker.angie.software/angie:templated
重新加载正在运行的容器的配置:
$ docker kill -s HUP angie-test
带有额外模块的镜像#
angie:latest
: 基于 Alpine 3.21 的版本 1.10.1。angie:<VERSION>
,angie:<VERSION>-alpine
: 基于 Alpine 3.21 的指定版本。angie:<VERSION>-debian
: 基于 Debian 12 的指定版本。angie:<VERSION>-rocky
: 基于 Rocky Linux 9 的指定版本。angie:<VERSION>-ubuntu
: 基于 Ubuntu 24.04 LTS 的指定版本。
这些包含以下 包
(如果它们为构建镜像时的 Angie 版本 发布):包列表
angie-console-light
angie-module-auth-jwt
angie-module-auth-spnego
angie-module-brotli
angie-module-cache-purge
angie-module-dav-ext
angie-module-dynamic-limit-req
angie-module-echo
angie-module-enhanced-memcached
angie-module-eval
angie-module-geoip2
angie-module-headers-more
angie-module-http-auth-radius
angie-module-image-filter
angie-module-keyval
angie-module-lua
angie-module-modsecurity
angie-module-ndk
angie-module-njs
angie-module-opentracing
angie-module-otel
angie-module-perl
angie-module-postgres
angie-module-redis2
angie-module-rtmp
angie-module-set-misc
angie-module-subs
angie-module-testcookie
angie-module-upload
angie-module-vod
angie-module-vts
angie-module-wasm
angie-module-wasmtime
angie-module-xslt
angie-module-zip
angie-module-zstd
运行#
要在 8080 端口启动一个带有 Angie 的容器,
提供对静态文件目录 /var/www/
和当前工作目录中的配置文件 angie.conf
的只读访问:
$ docker run --rm --name angie -v /var/www:/usr/share/angie/html:ro \
-v $(pwd)/angie.conf:/etc/angie/angie.conf:ro -p 8080:80 -d docker.angie.software/angie:latest
$ curl -I localhost:8080
HTTP/1.1 200 OK
Server: Angie/1.10.1
Date: Thu, 17 Jul 2025 10:42:54 GMT
Content-Type: text/html
Content-Length: 543
Last-Modified: Thu, 17 Jul 2025 09:12:23 GMT
Connection: keep-alive
ETag: "64c3ccc7-21f"
Accept-Ranges: bytes
这样的配置适用于本地开发和配置。
构建自定义镜像#
您还可以基于受支持的发行版构建自己的镜像,
从 包 或 源代码 添加 Angie 层。
相应的 Dockerfile
文件示例:
FROM debian:12
LABEL org.opencontainers.image.authors="Release Engineering Team <devops@tech.wbsrv.ru>"
ARG DEBIAN_FRONTEND=noninteractive
RUN set -x \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
ca-certificates curl \
&& curl -o /etc/apt/trusted.gpg.d/angie-signing.gpg \
https://angie.software/keys/angie-signing.gpg \
&& echo "deb https://download.angie.software/angie/$(. /etc/os-release && echo \"$ID/$VERSION_ID $VERSION_CODENAME\") main" \
> /etc/apt/sources.list.d/angie.list \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
angie angie-module-geoip2 angie-module-njs \
&& rm -Rf /var/lib/apt/lists \
/etc/apt/sources.list.d/angie.list \
/etc/apt/trusted.gpg.d/angie-signing.gpg \
&& ln -sf /dev/stdout /var/log/angie/access.log \
&& ln -sf /dev/stderr /var/log/angie/error.log
EXPOSE 80
CMD ["angie", "-g", "daemon off;"]
FROM alpine:3.19
LABEL org.opencontainers.image.authors="Release Engineering Team <devops@tech.wbsrv.ru>"
RUN set -x \
&& apk add --no-cache ca-certificates curl \
&& curl -o /etc/apk/keys/angie-signing.rsa https://angie.software/keys/angie-signing.rsa \
&& echo "https://download.angie.software/angie/alpine/v$(egrep -o \
'[0-9]+\.[0-9]+' /etc/alpine-release)/main" >> /etc/apk/repositories \
&& apk add --no-cache angie angie-module-geoip2 angie-module-njs \
&& rm /etc/apk/keys/angie-signing.rsa \
&& ln -sf /dev/stdout /var/log/angie/access.log \
&& ln -sf /dev/stderr /var/log/angie/error.log
EXPOSE 80
CMD ["angie", "-g", "daemon off;"]
要在包含这样的 Dockerfile
的目录中构建 myangie
镜像
并如上所示启动容器:
$ docker build -t myangie .
$ docker run --rm --name myangie -v /var/www:/usr/share/angie/html:ro \
-v $(pwd)/angie.conf:/etc/angie/angie.conf:ro -p 8080:80 -d myangie