> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/gateway/for-administrators/install/docker.md). Agents can also search and read this documentation through its [MCP server](https://docs.devolutions.net/~gitbook/mcp).

# Run in Docker

Run Devolutions Gateway in Docker with the official image: environment variables, TLS, persistent data, what is rewritten at each start, and upgrades.

Devolutions Gateway is published as a Linux container image on Docker Hub: [devolutions/devolutions-gateway](https://hub.docker.com/r/devolutions/devolutions-gateway). The container is configured with environment variables: at every start, its entry point script writes `gateway.json` from these variables with the DevolutionsGateway PowerShell module, then starts Devolutions Gateway.

{% hint style="warning" %}
The configuration folder of the container, `/tmp/devolutions-gateway`, is inside the container. Without a volume, the configuration, the keys, the certificate and the recordings are lost when the container is removed or recreated, for example during an upgrade. Mount a volume on `/tmp/devolutions-gateway`, and on `RECORDING_PATH` if you move the recordings elsewhere.
{% endhint %}

## About the image

<table><thead><tr><th width="260">ITEM</th><th>VALUE</th></tr></thead><tbody><tr><td><strong>Image</strong></td><td><code>devolutions/devolutions-gateway</code></td></tr><tr><td><strong>Tags</strong></td><td>One tag per release version, and <code>latest</code>. Use a version tag in production so that upgrades are deliberate.</td></tr><tr><td><strong>Architectures</strong></td><td><code>linux/amd64</code> and <code>linux/arm64</code>. Docker pulls the one that matches the host.</td></tr><tr><td><strong>Base</strong></td><td>Debian 12 (<code>bookworm-slim</code>) with PowerShell 7 and the DevolutionsGateway PowerShell module.</td></tr><tr><td><strong>Exposed ports</strong></td><td><code>7171</code> (HTTP or HTTPS listener) and <code>8181</code> (TCP listener).</td></tr><tr><td><strong>Configuration folder</strong></td><td><code>/tmp/devolutions-gateway</code> (variable <code>DGATEWAY_CONFIG_PATH</code>): <code>gateway.json</code>, provisioner keys, <code>server.crt</code> and <code>server.key</code>, <code>users.txt</code>, logs and, by default, the <code>recordings</code> folder.</td></tr><tr><td><strong>Health check</strong></td><td><code>/jet/health</code>, no token needed. <code>curl</code> is included in the image.</td></tr><tr><td><strong>Signature</strong></td><td>Images are signed with <a href="https://github.com/sigstore/cosign">Cosign</a>.</td></tr></tbody></table>

## Prerequisites

* A Linux host with Docker Engine or another OCI-compatible runtime, and optionally Docker Compose.
* The ports you publish (`7171` and `8181` by default) open in the host firewall.
* A DNS name for Devolutions Gateway that clients resolve, for example `gateway.contoso.com`.
* For production, a certificate and its private key in PEM format for that name. See [Certificates and TLS](https://docs.devolutions.net/gateway/guides/certificates.md).
* The provisioner public key of Devolutions Server or Devolutions Cloud: ***Administration*** – ***Devolutions Gateway*** – ***More*** – ***Download public key***.
* DNS resolution, from inside the container, of the hosts that sessions connect to. If they're only known by an internal DNS server, set it with the `--dns` option of `docker run`.

## Run a container

The variables that hold keys and certificates take the **Base64-encoded content** of the PEM file. On Linux, encode a file with `base64 -w0`; in PowerShell, with `[Convert]::ToBase64String([IO.File]::ReadAllBytes('provisioner.pem'))`.

```shell
export PROVISIONER_PUBLIC_KEY_B64=$(base64 -w0 provisioner.pem)
export TLS_CERTIFICATE_B64=$(base64 -w0 fullchain.pem)
export TLS_PRIVATE_KEY_B64=$(base64 -w0 privkey.pem)

docker run -d \
  --name devolutions-gateway \
  --restart unless-stopped \
  -p 7171:7171 \
  -p 8181:8181 \
  -e HOSTNAME=gateway.contoso.com \
  -e WEB_SCHEME=https \
  -e PROVISIONER_PUBLIC_KEY_B64 \
  -e TLS_CERTIFICATE_B64 \
  -e TLS_PRIVATE_KEY_B64 \
  -v devolutions-gateway-data:/tmp/devolutions-gateway \
  devolutions/devolutions-gateway:<version>
```

{% hint style="warning" %}
Always set `HOSTNAME`. Docker sets `HOSTNAME` in every container to the container's own host name (by default the container ID). Without your value, Devolutions Gateway uses that name, and a generated self-signed certificate is issued for it.
{% endhint %}

Check that it runs:

```shell
docker logs devolutions-gateway
curl https://gateway.contoso.com:7171/jet/health
```

## Use Docker Compose

```yaml
services:
  devolutions-gateway:
    image: devolutions/devolutions-gateway:<version>
    container_name: devolutions-gateway
    restart: unless-stopped
    ports:
      - "7171:7171"
      - "8181:8181"
    environment:
      HOSTNAME: gateway.contoso.com
      WEB_SCHEME: https
      PROVISIONER_PUBLIC_KEY_B64: ${PROVISIONER_PUBLIC_KEY_B64}
      TLS_CERTIFICATE_B64: ${TLS_CERTIFICATE_B64}
      TLS_PRIVATE_KEY_B64: ${TLS_PRIVATE_KEY_B64}
    volumes:
      - devolutions-gateway-data:/tmp/devolutions-gateway
    healthcheck:
      test: ["CMD", "curl", "-fsk", "https://localhost:7171/jet/health"]
      interval: 30s
      timeout: 5s
      retries: 3

volumes:
  devolutions-gateway-data:
```

Put the Base64 values in a `.env` file next to `compose.yaml`, readable only by you (`chmod 600 .env`), then run `docker compose up -d`.

## Environment variables

### Web listener

<table><thead><tr><th width="240">VARIABLE</th><th>DESCRIPTION</th><th width="200">DEFAULT</th></tr></thead><tbody><tr><td><code>HOSTNAME</code></td><td>Host name of Devolutions Gateway, used in the external URLs and as the subject of the generated self-signed certificate.</td><td>The container host name set by Docker; <code>localhost</code> when the variable is empty.</td></tr><tr><td><code>WEB_SCHEME</code></td><td>Scheme of the web listener inside the container: <code>http</code> or <code>https</code>.</td><td><code>http</code></td></tr><tr><td><code>WEB_PORT</code> or <code>PORT</code></td><td>Port of the web listener inside the container. <code>PORT</code> wins over <code>WEB_PORT</code>.</td><td><code>7171</code></td></tr><tr><td><code>EXTERNAL_WEB_SCHEME</code></td><td>Scheme clients use, for example <code>https</code> behind a reverse proxy that handles TLS.</td><td>Value of <code>WEB_SCHEME</code></td></tr><tr><td><code>EXTERNAL_WEB_PORT</code></td><td>Port clients use, when the published port differs from the container port.</td><td>Value of <code>WEB_PORT</code></td></tr><tr><td><code>WEBSITE_HOSTNAME</code></td><td>Azure Web App for Containers: replaces <code>HOSTNAME</code>. With <code>WEBSITE_INSTANCE_ID</code> also set (as Azure does), the external scheme and port become <code>https</code> and <code>443</code>.</td><td>Set by Azure</td></tr></tbody></table>

### TCP listener

<table><thead><tr><th width="240">VARIABLE</th><th>DESCRIPTION</th><th width="200">DEFAULT</th></tr></thead><tbody><tr><td><code>TCP_ENABLED</code></td><td><code>true</code> or <code>false</code>: creates the TCP listener.</td><td><code>true</code>, or <code>false</code> when <code>WEB_APP_ENABLED</code> is <code>true</code></td></tr><tr><td><code>TCP_PORT</code></td><td>Port of the TCP listener inside the container.</td><td><code>8181</code></td></tr><tr><td><code>EXTERNAL_TCP_PORT</code></td><td>Port clients use for the TCP listener.</td><td>Value of <code>TCP_PORT</code></td></tr><tr><td><code>TCP_HOSTNAME</code></td><td>Host name clients use for the TCP listener.</td><td><code>*</code> (the value of <code>HOSTNAME</code>)</td></tr></tbody></table>

### Keys and certificate

<table><thead><tr><th width="240">VARIABLE</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><code>PROVISIONER_PUBLIC_KEY_B64</code></td><td>Base64-encoded provisioner public key (PEM) of Devolutions Server or Devolutions Cloud.</td></tr><tr><td><code>PROVISIONER_PRIVATE_KEY_B64</code></td><td>Base64-encoded provisioner private key (PEM). Only for the standalone web application with your own key pair.</td></tr><tr><td><code>TLS_CERTIFICATE_B64</code></td><td>Base64-encoded certificate (PEM), with the chain.</td></tr><tr><td><code>TLS_PRIVATE_KEY_B64</code></td><td>Base64-encoded private key (PEM) of the certificate.</td></tr><tr><td><code>TLS_CERTIFICATE_PASSWORD</code></td><td>Password of the private key, when it's encrypted.</td></tr></tbody></table>

### Standalone web application, recordings and logs

<table><thead><tr><th width="240">VARIABLE</th><th>DESCRIPTION</th><th width="200">DEFAULT</th></tr></thead><tbody><tr><td><code>WEB_APP_ENABLED</code></td><td><code>true</code> to enable the standalone web application.</td><td><code>false</code></td></tr><tr><td><code>WEB_APP_AUTHENTICATION</code></td><td><code>None</code> or <code>Custom</code>.</td><td><code>None</code>, or <code>Custom</code> when <code>WEB_APP_USERNAME</code> and <code>WEB_APP_PASSWORD</code> are both set</td></tr><tr><td><code>WEB_APP_USERNAME</code>, <code>WEB_APP_PASSWORD</code></td><td>User added to <code>users.txt</code> at every start, for <code>Custom</code> authentication.</td><td>Not set</td></tr><tr><td><code>RECORDING_PATH</code></td><td>Folder inside the container for session recordings.</td><td><code>/tmp/devolutions-gateway/recordings</code></td></tr><tr><td><code>VERBOSITY_PROFILE</code></td><td>Log verbosity: <code>Default</code>, <code>Debug</code>, <code>Tls</code>, <code>All</code> or <code>Quiet</code>.</td><td>Not set (<code>Default</code>)</td></tr></tbody></table>

{% hint style="warning" %}
Environment variables are visible to anyone who can run `docker inspect` on the host or read the Compose file. Restrict access to the Docker host and to your `.env` file.
{% endhint %}

## What happens at each start

* **Rewritten from the environment:** the host name, the listeners and the standalone web application settings. Changing these values in `gateway.json` has no lasting effect.
* **Settings without a variable:** the entry point saves `gateway.json` with the DevolutionsGateway PowerShell module, which keeps only the keys it knows. Keys such as `RecordingPath`, `Subscriber`, `SubProvisionerPublicKey`, `Ngrok` or `AgentTunnel` that you add to the `gateway.json` of the volume are kept. Keys the module doesn't know, such as `TlsVerifyStrict`, `Proxy`, `MinRecordingStorageFreeSpace` and the `CredSsp…` keys, are removed at every start. See [Manage Devolutions Gateway with PowerShell](https://docs.devolutions.net/gateway/for-administrators/powershell.md).
* **Provisioner keys:** imported from `PROVISIONER_PUBLIC_KEY_B64` and `PROVISIONER_PRIVATE_KEY_B64` when set. When neither is set, a **new key pair is generated at every start**, and tokens from Devolutions Server or Devolutions Cloud stop being accepted after a restart. Always pass the provisioner public key when the container is used with Devolutions Server or Devolutions Cloud.
* **Certificate:** imported from `TLS_CERTIFICATE_B64` and `TLS_PRIVATE_KEY_B64` when set. When `WEB_SCHEME` is `https` and no certificate is configured, a self-signed certificate is generated: RSA 2048-bit, common name = `HOSTNAME`, valid five years, without Subject Alternative Name. Browsers and Devolutions Server must trust it explicitly; use it for tests only.

## Configure TLS

* **Your own certificate (recommended):** `WEB_SCHEME=https` with `TLS_CERTIFICATE_B64` and `TLS_PRIVATE_KEY_B64`. To renew, update the values and recreate the container. PFX files aren't supported by these variables: convert them to PEM.
* **Self-signed certificate:** `WEB_SCHEME=https` without certificate variables. For tests only.
* **TLS on a reverse proxy:** keep `WEB_SCHEME=http`, set `EXTERNAL_WEB_SCHEME=https` and `EXTERNAL_WEB_PORT` (for example `443`), and don't publish port 7171 to clients directly. See [Reverse proxies](https://docs.devolutions.net/gateway/guides/reverse-proxies.md).

WebSocket connections of web sessions need a certificate the browser trusts. Don't expose a plain HTTP listener to clients in production.

## Link the container to Devolutions Server or Devolutions Cloud

1. Download the provisioner public key in ***Administration*** – ***Devolutions Gateway*** – ***More*** – ***Download public key***.
2. Pass its Base64-encoded content in `PROVISIONER_PUBLIC_KEY_B64` and recreate the container.
3. Register the gateway with the external host name and ports clients use, for example `https://gateway.contoso.com:7171` and TCP host `gateway.contoso.com`, port `8181`. See [Register and configure the gateway in Devolutions Server](https://docs.devolutions.net/gateway/guides/devolutions-server/register-and-configure.md) or [Register and configure the gateway in Devolutions Cloud](https://docs.devolutions.net/gateway/guides/devolutions-cloud/register-and-configure.md).

## Run the standalone web application

To use Devolutions Gateway without Devolutions Server or Devolutions Cloud:

```shell
docker run -d \
  --name devolutions-gateway \
  -p 7171:7171 \
  -e HOSTNAME=gateway.contoso.com \
  -e WEB_SCHEME=https \
  -e WEB_APP_ENABLED=true \
  -e WEB_APP_USERNAME=gatewayadmin \
  -e WEB_APP_PASSWORD \
  -v devolutions-gateway-data:/tmp/devolutions-gateway \
  devolutions/devolutions-gateway:<version>
```

`-e WEB_APP_PASSWORD` without a value passes the variable of your shell, so the password doesn't appear in the command. Open `https://gateway.contoso.com:7171`. In this mode, the TCP listener is off unless `TCP_ENABLED=true`. The web application needs the provisioner private key: let the container generate the key pair (no provisioner variable), or pass both `PROVISIONER_PUBLIC_KEY_B64` and `PROVISIONER_PRIVATE_KEY_B64`. With only the public key, Devolutions Gateway stops with "provisioner private key must be specified when the standalone web application is enabled".

{% hint style="danger" %}
With `WEB_APP_AUTHENTICATION=None`, the default when no user name and password are set, anyone who reaches the listener can use the web application. Always set `WEB_APP_USERNAME` and `WEB_APP_PASSWORD` when the container is reachable from other machines.
{% endhint %}

## Upgrade

Pull the new image and recreate the container with the same parameters. The configuration stays in the volume, and the keys and certificate are imported again from the variables.

```shell
# Docker Compose: change the tag in compose.yaml, then
docker compose pull
docker compose up -d

# docker run
docker pull devolutions/devolutions-gateway:<version>
docker stop devolutions-gateway
docker rm devolutions-gateway
# run the same docker run command with the new tag
```

Updates through Devolutions Agent and the update script for Windows don't apply to containers.

## Limitations

* Only Linux images are published. The Windows certificate store isn't available.
* Certificates and keys are passed in PEM format through variables.
* Settings that the DevolutionsGateway PowerShell module doesn't know can't be kept across restarts, including `"TlsVerifyStrict": true`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/gateway/for-administrators/install/docker.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
