> 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/agent/for-administrators/deploy/docker.md). Agents can also search and read this documentation through its [MCP server](https://docs.devolutions.net/~gitbook/mcp).

# Run Devolutions Agent in Docker

Run the Devolutions Agent Docker image as a PowerShell Universal agent, with its environment variables, PowerShell 7 and HTTPS settings.

The ***Devolutions Agent*** Docker image `devolutions/devolutions-agent` runs Devolutions Agent on Linux as a PowerShell Universal agent: PowerShell Universal connects to it and runs jobs inside the container. The image is built for that use only.

## What the image contains

<table><thead><tr><th width="230">ITEM</th><th>DETAILS</th></tr></thead><tbody><tr><td><strong>Image</strong></td><td><code>devolutions/devolutions-agent</code> on Docker Hub, tags <code>latest</code> and one tag per version.</td></tr><tr><td><strong>Architectures</strong></td><td><code>linux/amd64</code> and <code>linux/arm64</code>.</td></tr><tr><td><strong>Base</strong></td><td>Debian (slim).</td></tr><tr><td><strong>User</strong></td><td>Runs as the non-root user <code>devolutions-agent</code>, home <code>/var/lib/devolutions-agent</code>.</td></tr><tr><td><strong>PowerShell</strong></td><td>PowerShell 7 installed for the <code>devolutions-agent</code> user in <code>/var/lib/devolutions-agent/.pwsh/bin/pwsh</code>, with the <code>multi-pwsh</code> tool. PowerShell telemetry is turned off (<code>POWERSHELL_TELEMETRY_OPTOUT=1</code>).</td></tr><tr><td><strong>Configuration</strong></td><td><code>/etc/devolutions-agent/agent.json</code>, written by the image at every start.</td></tr><tr><td><strong>Ports</strong></td><td>None. The agent connects out to PowerShell Universal.</td></tr></tbody></table>

## Environment variables

<table><thead><tr><th width="270">VARIABLE</th><th width="200">DEFAULT</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><code>PSU_SERVER_URL</code></td><td>Empty</td><td>Address of the PowerShell Universal server, <code>http://</code> or <code>https://</code>.</td></tr><tr><td><code>PSU_APP_TOKEN</code></td><td>Empty</td><td>PowerShell Universal application token.</td></tr><tr><td><code>PSU_AGENT_ID</code></td><td><code>devolutions-agent-linux</code></td><td>Agent identifier in PowerShell Universal. Give each container its own value.</td></tr><tr><td><code>PSU_DISPLAY_NAME</code></td><td><code>Devolutions Agent Linux</code></td><td>Name shown in PowerShell Universal.</td></tr><tr><td><code>PSU_POWERSHELL_EXECUTABLE</code></td><td><code>/var/lib/devolutions-agent/.pwsh/bin/pwsh</code></td><td>PowerShell executable that runs the jobs.</td></tr></tbody></table>

The PowerShell Universal connection is turned on only when both `PSU_SERVER_URL` and `PSU_APP_TOKEN` are set. With only one of them, the container stops with "PSU\_SERVER\_URL and PSU\_APP\_TOKEN must both be set to enable the PSU agent". With neither, the agent starts with no feature turned on.

## Run the container

1. In PowerShell Universal, create an application token for the agent.
2. Start the container, here for a PowerShell Universal server on the Docker host:

   ```powershell
   docker run -d --name devolutions-agent `
     --add-host host.docker.internal:host-gateway `
     --env PSU_SERVER_URL='http://host.docker.internal:5006' `
     --env PSU_APP_TOKEN='<application token>' `
     --env PSU_AGENT_ID='docker-agent-01' `
     devolutions/devolutions-agent:latest
   ```
3. Check the messages of the agent with `docker logs devolutions-agent`. "PSU gRPC agent registration accepted" means PowerShell Universal accepted the agent.

{% hint style="warning" %}
An application token passed with `--env` on the command line is visible to other processes on the host and in `docker inspect`. Prefer an environment file with restricted permissions (`--env-file`) or the secret management of your container platform.
{% endhint %}

## Use HTTPS

Set `PSU_SERVER_URL` to an `https://` address. The certificate of the PowerShell Universal server must be trusted by the system certificate store of the container; for a certificate from a private certificate authority, build an image from `devolutions/devolutions-agent` that adds that authority to the system store. With an `http://` address to another host, the agent logs "PSU gRPC agent uses plaintext HTTP to a non-loopback host; the AppToken and job traffic are not encrypted".

## Good to know

* **The configuration is rewritten at every start.** The image writes `agent.json` with the update module and the RDP Extension turned off and the `PsuAgent` section built from the environment variables. Changes made inside the container, including an Agent Tunnel enrollment, are lost when the container restarts. For the Agent Tunnel on Linux, install the [Linux package](https://docs.devolutions.net/agent/for-administrators/deploy/linux.md).
* **Stopping a job stops its processes.** When PowerShell Universal stops a job, Devolutions Agent stops the job process and its process group. Processes that a job moves to their own session or process group, for example with `setsid`, keep running.
* **Logs** go to the container output (`docker logs`) and to `/etc/devolutions-agent/agent*.log` inside the container.

## Next

* [PowerShell Universal agent](https://docs.devolutions.net/agent/guides/powershell-universal-agent.md)
* [Update and uninstall Devolutions Agent](https://docs.devolutions.net/agent/for-administrators/deploy/update-and-uninstall.md)


---

# 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/agent/for-administrators/deploy/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.
