<!-- review: finished -->

<a id="docker-images"></a>

# Angie Docker Images

To run Angie in a
[Docker](https://docs.docker.com/engine/reference/commandline/cli/) container,
use the images from our registry: `docker.angie.software`.
They are built based on our [binary packages](https://en.angie.software//angie/docs/installation/oss_packages.md#oss-packages)
and the official base images of several operating systems.

#### NOTE
Also note the [Docker](https://en.angie.software//angie/docs/configuration/modules/http/http_docker.md#http-docker) module,
which implements dynamic updating of upstream server groups
based on Docker container labels.

<a id="minimal-images"></a>

## Minimal Images

- `angie:minimal`:
  version  based on Alpine 3.22.
- `angie:<VERSION>-minimal`:
  specified version based on Alpine 3.22.

These images include only the `angie` package.

<a id="docker-templated"></a>

## Templated Images

- `angie:templated`:
  version  based on Alpine 3.22.
- `angie:<VERSION>-templated`:
  specified version based on Alpine 3.22.

These images set the following environment variables:

```docker
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"
```

These variables can be used to customize the container behavior:

- `ANGIE_BINARY`:
  Allows running the [debug version](https://en.angie.software//angie/docs/troubleshooting.md#debug-logging).
- `ANGIE_ERROR_LOG_SEVERITY`:
  Sets the severity level for entries in the main [error log](https://en.angie.software//angie/docs/configuration/processing.md#logging) file.
- `ANGIE_LOAD_MODULES`:
  Loads one or more available modules (all modules are included in the image).
  Specify a comma-separated list of modules without spaces.
- `ANGIE_PID_FILE`:
  Sets an alternative location for the process identifier (PID) file.
- `ANGIE_FEATURE_TEMPLATE`:
  Generates [Angie configuration](https://en.angie.software//angie/docs/configuration/configfile.md#configfile) using the
  [gomplate](https://docs.gomplate.ca/) tool at container startup. Parameters
  used: `--input-dir /etc/angie/templates` and
  `--output-dir /etc/angie`.
- `ANGIE_FEATURE_RELOAD`:
  Enables handling of `SIGHUP`, `SIGQUIT`, and `SIGTERM`
  signals.

These include the following
[packages](https://en.angie.software//angie/docs/installation/external-modules/index.md#install-thirdpartymodules)
(if they were released for the [Angie version](https://en.angie.software//angie/docs/oss_changes.md#oss-changes)
that the image was built with):

### Package List

- `angie-console-light`
- `angie-module-auth-jwt`
- `angie-module-auth-ldap`
- `angie-module-auth-pam`
- `angie-module-auth-spnego`
- `angie-module-auth-totp`
- `angie-module-brotli`
- `angie-module-cache-purge`
- `angie-module-cgi`
- `angie-module-combined-upstreams`
- `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-unbrotli`
- `angie-module-upload`
- `angie-module-vod`
- `angie-module-vts`
- `angie-module-wasm`
- `angie-module-wasmtime`
- `angie-module-xslt`
- `angie-module-zip`
- `angie-module-zstd`

<a id="examples-1"></a>

### Examples

The configuration used in templated images applies the variables
approximately as follows:

```none
...
{{- 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  ...
```

Running a container with shell access:

```console
$ docker run -it --pull always --rm --entrypoint=sh \
  docker.angie.software/angie:templated
```

Run Angie with custom connection parameters and modules
(the command **angie -T** will output the complete configuration):

```console
$ docker run -it --rm -e ANGIE_WORKER_CONNECTIONS=4 \
  -e ANGIE_LOAD_MODULES="auth-jwt,vod" \
  docker.angie.software/angie:templated angie -T
```

Start a container with a specified name and additional modules:

```console
$ docker run -it --rm --name angie-test \
  -e ANGIE_WORKER_CONNECTIONS=4 \
  -e ANGIE_LOAD_MODULES="auth-jwt,vod" \
  docker.angie.software/angie:templated
```

Reload the configuration of a running container:

```console
$ docker kill -s HUP angie-test
```

<a id="images-with-extra-modules"></a>

## Images with Extra Modules

- `angie:latest`:
  version  based on Alpine 3.22.
- `angie:<VERSION>`,
  `angie:<VERSION>-alpine`:
  specified version based on Alpine 3.22.
- `angie:<VERSION>-debian`:
  specified version based on Debian 13.
- `angie:<VERSION>-rocky`:
  specified version based on Rocky Linux 9.
- `angie:<VERSION>-ubuntu`:
  specified version based on Ubuntu 24.04 LTS.

These include the following
[packages](https://en.angie.software//angie/docs/installation/external-modules/index.md#install-thirdpartymodules)
(if they were released for the [Angie version](https://en.angie.software//angie/docs/oss_changes.md#oss-changes)
that the image was built with):

### Package List

- `angie-console-light`
- `angie-module-auth-jwt`
- `angie-module-auth-ldap`
- `angie-module-auth-pam`
- `angie-module-auth-spnego`
- `angie-module-auth-totp`
- `angie-module-brotli`
- `angie-module-cache-purge`
- `angie-module-cgi`
- `angie-module-combined-upstreams`
- `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-unbrotli`
- `angie-module-upload`
- `angie-module-vod`
- `angie-module-vts`
- `angie-module-wasm`
- `angie-module-wasmtime`
- `angie-module-xslt`
- `angie-module-zip`
- `angie-module-zstd`

<a id="running"></a>

## Running

To start a container with Angie on port 8080,
providing read-only access to the static files directory `/var/www/`
and the configuration file `angie.conf` located in the current working directory:

```console
$ 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/|version|
    Date: |sampledatelong| 10:42:54 GMT
    Content-Type: text/html
    Content-Length: 543
    Last-Modified: |sampledatelong| 09:12:23 GMT
    Connection: keep-alive
    ETag: "64c3ccc7-21f"
    Accept-Ranges: bytes
```

Such configurations are suitable for local development and configuration.

<a id="building-custom-images"></a>

## Building Custom Images

You can also build your own image
based on a supported distribution,
adding the Angie layer from [packages](https://en.angie.software//angie/docs/installation/oss_packages.md#oss-packages)
or [source code](https://en.angie.software//angie/docs/installation/sourcebuild.md#sourcebuild).
Examples of corresponding `Dockerfile` files:

```dockerfile
FROM debian:13

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;"]
```

```dockerfile
FROM alpine:3.22

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;"]
```

To build a `myangie` image in the directory with such a `Dockerfile`
and start a container as shown above:

```console
$ 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
```
