# Add a Docker Swarm environment

When connecting a Docker Swarm environment to Portainer, there are a few different methods you can use depending on your particular requirements. You can install the Portainer Agent on the Docker Swarm cluster and connect via the agent, you can connect directly to the Docker API or the Docker socket, or you can deploy the Portainer Edge Agent in standard or async mode.

Regardless of the method you choose, there are some generic requirements you will need to meet. You will require:

* The latest [supported](/2.33-lts/start/requirements-and-prerequisites.md) version of Docker installed and working on your Docker Swarm nodes.
* Swarm mode enabled and working, including the overlay network for the swarm service communication.
* `sudo`, `root` or Administrator access on the manager node of your swarm cluster.

The installation instructions also make the following assumptions about your environment:

* Your environment meets [our requirements](/2.33-lts/start/requirements-and-prerequisites.md). While Portainer may work with other configurations, it may require configuration changes or have limited functionality.
* Docker is running as root (for Linux) or an Administrator (for Windows). Portainer with rootless Docker has some limitations, and requires additional configuration.
* If your nodes are using DNS records to communicate, that all records are resolvable across the cluster.

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Agent</strong></td><td></td><td></td><td><a href="/files/KQPhtkJBlXhTVOUQrPzO">/files/KQPhtkJBlXhTVOUQrPzO</a></td><td><a href="/pages/LRbkGP4UJTNk8XUELZCy">/pages/LRbkGP4UJTNk8XUELZCy</a></td></tr><tr><td><strong>API</strong></td><td></td><td></td><td><a href="/files/1mS7Hk8sxYH426WmMpKm">/files/1mS7Hk8sxYH426WmMpKm</a></td><td><a href="/pages/qkJ9COdSo1YdRF9hfNhF">/pages/qkJ9COdSo1YdRF9hfNhF</a></td></tr><tr><td><strong>Socket</strong></td><td></td><td></td><td><a href="/files/4UCLh1R37HKkEJZTHLcS">/files/4UCLh1R37HKkEJZTHLcS</a></td><td><a href="/pages/2I2i05bn5TVE5lZSchTA">/pages/2I2i05bn5TVE5lZSchTA</a></td></tr><tr><td><strong>Edge Agent Standard</strong></td><td></td><td></td><td><a href="/files/K2sAiKuaUnXONjrBvgJZ">/files/K2sAiKuaUnXONjrBvgJZ</a></td><td><a href="/pages/tLR8Fb4MAi6v6fSZsSAF">/pages/tLR8Fb4MAi6v6fSZsSAF</a></td></tr><tr><td><strong>Edge Agent Async</strong></td><td></td><td></td><td><a href="/files/ojNZAcFFpS7Vat45sJOb">/files/ojNZAcFFpS7Vat45sJOb</a></td><td><a href="/pages/Drx89SAtAVtx5sadGZOl">/pages/Drx89SAtAVtx5sadGZOl</a></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.portainer.io/2.33-lts/admin/environments/add/swarm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
