Add a Docker Swarm environment

Deploying the agent

From the menu select Environments then click Add environment. Ensure Agent is selected in Environment type.
In the Information section select the correct operating system for the new environment then select the Docker Swarm tab. Copy the command, then run it on the manager node of your Docker Swarm cluster.
You must run the command on the Docker Swarm cluster before entering the environment details.
An example command for a Linux endpoint
The deployment command will return something similar to this:
1
Creating network portainer-agent_portainer_agent
2
Creating service portainer-agent_agent
Copied!
To validate the agent is running, run the following command:
1
docker service ls
Copied!
The result of which should look something like this:
1
ID NAME MODE REPLICAS IMAGE PORTS
2
tshb6ee2710s portainer-agent_agent global 1/1 portainer/agent:latest
Copied!

Finishing the configuration

Once the agent is running on the Docker Swarm cluster, enter the environment details, using the table below as a guide:
Field
Overview
Name
Give the environment a descriptive name. This is a required field.
Endpoint URL
Enter the IP or DNS name at which the Portainer Server instance can reach the environment along with the port (9001) if required. This is a required field.
Public IP
URL or IP address where exposed containers will be reachable. This is an optional field and will default to the environment URL. You can change it later if you need to.
In the Metadata section, as an optional step you can categorize the environment by adding it to a group or tagging it for better searchability.
When you're ready click Add environment.
Last modified 1mo ago