Portainer Documentation: Release 1.22.1
Portainer Documentation: Release 1.22.1
Portainer Documentation: Release 1.22.1
Release 1.22.1
Portainer.io
1 Deployment 3
1.1 Quick start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Inside a Swarm cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Persist Portainer data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Advanced deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Configuration 9
2.1 Admin password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Hiding specific containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Use your own logo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4 Use your own templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5 Use an external endpoint source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.6 Available flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3 API 13
3.1 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4 Agent 15
4.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.2 Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.4 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5 External endpoints 21
5.1 Endpoint definition format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.2 Endpoint synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6 Templates 25
6.1 Container template definition format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.2 Stack template definition format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.3 Build and host your own templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
7 Troubleshooting 37
7.1 Ensuring Docker is configured correctly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.2 Ensuring Docker Swarm is configured correctly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
8 Contribute 39
i
8.1 Build Portainer locally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.2 Contribution guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
8.3 Contributing to the documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
9 Limitations 41
9.1 Docker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
9.2 Swarm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
9.3 Supported platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
10 FAQ 43
10.1 Contact us . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
10.2 How do I reset my Portainer password? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
10.3 Why are my stacks marked as Limited in Portainer? . . . . . . . . . . . . . . . . . . . . . . . . . . 43
10.4 Why is my version number not matching the latest version? . . . . . . . . . . . . . . . . . . . . . . 44
10.5 Can I activate my extension licenses without an internet connection? . . . . . . . . . . . . . . . . . 44
10.6 My licenses/extensions don’t activate, what do I do? . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.7 Users have access to an endpoint, but they cannot see anything. Why? . . . . . . . . . . . . . . . . . 44
10.8 Portainer lost it’s configuration, why? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.9 How do I make sure Portainer stays where my data is persisted? . . . . . . . . . . . . . . . . . . . . 45
10.10 Why doesn’t Portainer support compose version 3 on a standalone (non-swarm) host? . . . . . . . . 45
10.11 How do I get the logs from Portainer? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
10.12 Published ports in the services view redirect me to about:blank#blocked, what can I do? . . . . . . . 47
10.13 External endpoints are not working in the latest Portainer version, is this a bug? . . . . . . . . . . . . 49
10.14 Where can I find the source code of the Portainer agent? . . . . . . . . . . . . . . . . . . . . . . . . 49
10.15 My host is using SELinux, can I use Portainer ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
10.16 How can I use Portainer behind a proxy? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
10.17 How can I expose the Docker API over TCP so that Portainer can communicate with my environment? 50
10.18 How can I set up Portainer on Windows Server 2016? . . . . . . . . . . . . . . . . . . . . . . . . . 50
10.19 How can I play with Portainer outside of the public demo? . . . . . . . . . . . . . . . . . . . . . . . 50
10.20 Exposed ports in the container view redirects me to 0.0.0.0, what can I do? . . . . . . . . . . . . . . 50
10.21 How do I troubleshoot Portainer? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
ii
Portainer Documentation, Release 1.22.1
Contents 1
Portainer Documentation, Release 1.22.1
2 Contents
CHAPTER 1
Deployment
Portainer is built to run on Docker and is really simple to deploy. Portainer deployment scenarios can be executed on
any platform unless specified.
Voilà, you can now use Portainer by accessing the port 9000 on the server where Portainer is running.
Before deploying Portainer inside your Swarm cluster, you should ensure that Docker and your Swarm are configured
correctly. You can refer to the Troubleshooting section to ensure you have correctly configured your environment.
Following the above, you are ready to deploy Portainer inside a Swarm cluster using our recommended agent-enabled
deployment. Note: This setup will assume that you’re executing the following instructions on a Swarm manager node.
Have a look at the Agent section to find more details on how to connect an existing Portainer instance to a manually
deployed Portainer agent.
3
Portainer Documentation, Release 1.22.1
By default, Portainer store its data inside the container in the /data folder on Linux (C:\\data on Windows).
You’ll need to persist Portainer data to keep your changes after restart/upgrade of the Portainer container. You can use
a bind mount on Linux to persist the data on the Docker host folder:
1.3.1 Windows
Docker for Windows 10 supports running both Linux and Windows containers and you need to use a different start
command depending on which container type you are using. Windows Server supports only native Windows contain-
ers.
Note: You must create the folder in which you want the data to be persisted before running the following command.
For example, if you want the data to persist in C:ProgramDataPortainer you need to create the Portainer directory
within C:ProgramData as it does not exist by default.
Example for Linux containers:
˓→portainer
˓→portainer/portainer
Note: The Swarm service example will persist Portainer data in /path/on/host/data for each host in the cluster.
If the container is re-scheduled on another node, existing Portainer data might not be available. Persisting data across
all nodes of a Swarm cluster is outside the scope of this documentation.
4 Chapter 1. Deployment
Portainer Documentation, Release 1.22.1
You can specify the initial environment you want Portainer to manage via the CLI, use the -H flag and the tcp://
protocol to connect to a remote Docker environment:
$ docker run -d -p 9000:9000 -p 8000:8000 --name portainer --restart always -v
˓→portainer_data:/data portainer/portainer -H tcp://<REMOTE_HOST>:<REMOTE_PORT>
Ensure you replace REMOTE_HOST and REMOTE_PORT with the address/port of the Docker server you want to
manage.
You can also bind mount the Docker socket to manage a local Docker environment (only possible on environments
where the Unix socket is available):
$ docker run -d -p 9000:9000 -p 8000:8000 --name portainer --restart always -v /var/
˓→run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer -H
˓→unix:///var/run/docker.sock
If your Docker environment is protected using TLS, you’ll need to ensure that you have access to CA, the certificate
and the public key used to access your Docker engine.
You can upload the required files via the Portainer UI or use the --tlsverify flag on the CLI.
Portainer will try to use the following paths to the files specified previously (on Linux, see the configuration section
for details about Windows):
• CA: /certs/ca.pem
• certificate: /certs/cert.pem
• public key: /certs/key.pem
You must ensure these files are present in the container using a bind mount:
$ docker run -d -p 9000:9000 -p 8000:8000 --name portainer --restart always -v /path/
˓→to/certs:/certs -v portainer_data:/data portainer/portainer -H tcp://<DOCKER_HOST>:
˓→<DOCKER_PORT> --tlsverify
You can also use the --tlscacert, --tlscert and --tlskey flags if you want to change the default path to
the CA, certificate and key file respectively:
$ docker run -d -p 9000:9000 -p 8000:8000 --name portainer -v /path/to/certs:/certs
˓→portainer/portainer -H tcp://<DOCKER_HOST>:<DOCKER_PORT> --tlsverify --tlscacert /
˓→tlskey /certs/myKey.pem
By default, Portainer’s web interface and API is exposed over HTTP. This is not secured, it’s recommended to enable
SSL in a production environment.
To do so, you can use the following flags --ssl, --sslcert and --sslkey:
$ docker run -d -p 443:9000 -p 8000:8000 --name portainer --restart always -v ~/local-
˓→certs:/certs -v portainer_data:/data portainer/portainer --ssl --sslcert /certs/
You can use the following commands to generate the required files:
Note that Certbot could be used as well to generate a certificate and a key. However, because Docker has issues with
symlinks, if you use Certbot, you will need to pass both the “live” and “archive” directories as volumes (shown below).
version: '2'
services:
portainer:
image: portainer/portainer
command: -H unix:///var/run/docker.sock
restart: always
ports:
- 9000:9000
- 8000:8000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
volumes:
portainer_data:
$ cd /opt
$ wget https://github.com/portainer/portainer/releases/download/1.22.1/portainer-1.22.
˓→1-linux-amd64.tar.gz
Then just use the portainer binary as you would use CLI flags with Docker.
6 Chapter 1. Deployment
Portainer Documentation, Release 1.22.1
Note: Portainer will try to write its data into the /data folder by default. You must ensure this folder exists first (or
change the path it will use via the --data, see below).
$ mkdir /data
$ cd /opt/portainer
$ ./portainer --template-file "${PWD}/templates.json"
$ ./portainer -p :8080
You can change the folder used by Portainer to store its data with the --data flag:
8 Chapter 1. Deployment
CHAPTER 2
Configuration
Portainer allows you to specify a bcrypt encrypted password from the command line for the admin account. You need
to generate the bcrypt encrypted password first.
You can generate the encrypted password with the following command:
$ htpasswd -nb -B admin <password> | cut -d ":" -f 2
or if your system does not provide htpasswd you can use a docker container with the command:
$ docker run --rm httpd:2.4-alpine htpasswd -nbB admin <password> | cut -d ":" -f 2
To specify the admin password from the command line, start Portainer with the --admin-password flag:
$ docker run -d -p 9000:9000 -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.
˓→sock portainer/portainer --admin-password='$2y$05$qFHAlNAH0A.6oCDe1/4W.ueCWC/
˓→iTfBMXIHBI97QYfMWlMCJ7N.a6'
You can also store the plaintext password inside a file and use the --admin-password-file flag:
# mypassword is plaintext here
$ echo -n mypassword > /tmp/portainer_password
$ docker run -d -p 9000:9000 -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.
˓→sock -v /tmp/portainer_password:/tmp/portainer_password portainer/portainer --admin-
(continues on next page)
˓→password-file /tmp/portainer_password
9
Portainer Documentation, Release 1.22.1
Note: This will automatically create an administrator account called admin with the specified password.
Portainer allows you to hide containers with a specific label by using the -l flag.
For example, take a container started with the label owner=acme (note that this is an example label, you can define
your own labels):
$ docker run -d --label owner=acme nginx
To hide this container, simply add the -l owner=acme option on the CLI when starting Portainer:
$ docker run -d -p 9000:9000 -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.
˓→sock portainer/portainer -l owner=acme
Note that the -l flag can be repeated multiple times to specify multiple labels:
$ docker run -d -p 9000:9000 -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.
˓→sock portainer/portainer -l owner=acme -l service=secret
You do not like our logo? Want to make Portainer more corporate? Don’t worry, you can easily switch for an external
logo (it must be exactly 155px by 55px) using the --logo flag:
$ docker run -d -p 9000:9000 -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.
˓→sock portainer/portainer --logo "https://www.docker.com/sites/all/themes/docker/
˓→assets/images/brand-full.svg"
10 Chapter 2. Configuration
Portainer Documentation, Release 1.22.1
By default Portainer templates will be used but you can also define your own templates.
Note: at the moment, templates are only loaded once at first Portainer startup. If you already deployed a Portainer
instance and want to use your own templates after this, you’ll need to clear any existing templates (default templates)
via the HTTP API.
There are two ways to specify your own templates:
Using the –template-file flag you can specify the path to your own template file on the file-system. By default, it points
to /templates.json on both Linux and Windows hosts.
For example, you can mount your own template file inside the container:
˓→templates/templates.json
Using the –templates flag you can specify an URL where the template file can be accessed via HTTP.
For more information about hosting your own template definitions see Templates
Portainer gives you the option to define all the endpoints available in the UI from a JSON file.
You just need to start Portainer with the --external-endpoints flag and specify the path to the JSON file in the
container.
Note: when using the external endpoint management, endpoint management will be disabled in the UI.
For more information about the endpoint definition format see External endpoints
• --admin-password-file: Path to the file containing the password for the admin user
• --bind, -p: Address and port to serve Portainer (default: :9000)
• --data, -d: Directory where Portainer data will be stored (default: /data on Linux, C:\data on Windows)
• --external-endpoints: Enable external endpoint management by specifying the path to a JSON endpoint
source in a file
• --hide-label, -l: Hide containers with a specific label in the UI
• --host, -H: Docker daemon endpoint
• --logo: URL to a picture to be displayed as a logo in the UI, use Portainer logo if not specified
• --no-analytics: Disable analytics (default: false)
• --no-snapshot: Disable periodic endpoint snapshot (default: false)
• --snapshot-interval: Time interval between two endpoint snapshot jobs expressed as a string, e.g. 30s,
5m, 1h. . . as supported by the time.ParseDuration method (default: 5m)
• --ssl: Secure Portainer instance using SSL (default: false)
• --sslcert: Path to the SSL certificate used to secure the Portainer instance (default: /certs/
portainer.crt, C:\certs\portainer.crt on Windows)
• --sslkey: Path to the SSL key used to secure the Portainer instance (default: /certs/portainer.key,
C:\certs\portainer.key on Windows)
• --sync-interval: Time interval between two endpoint synchronization requests expressed as a string, e.g.
30s, 5m, 1h. . . as supported by the time.ParseDuration method (default: 60s)
• --templates, -t: URL to templates (apps) definitions
• --template-file: Path on disk to templates (apps) definitions (default: /templates.json)
• --tlscacert: Path to the CA (default: /certs/ca.pem on Linux, C:\certs\ca.pem on Windows)
• --tlscert: Path to the TLS certificate file (default: /certs/cert.pem, C:\certs\cert.pem on
Windows)
• --tlskey: Path to the TLS key (default: /certs/key.pem, C:\certs\key.pem on Windows)
• --tlsverify: TLS support (default: false)
• --tunnel-port: Specify an alternate tunnel port to use with the Edge agent. Use --tunnel-port 8001
with -p 8001:8001 to make the Edge agent communicate on port 8001
12 Chapter 2. Configuration
CHAPTER 3
API
Portainer exposes an HTTP API that you can use to automate everything you do via the Portainer UI.
3.1 Documentation
The API documentation is available on Swaggerhub and you can also find some examples here.
13
Portainer Documentation, Release 1.22.1
14 Chapter 3. API
CHAPTER 4
Agent
4.1 Purpose
The Portainer Agent is a workaround for a Docker API limitation when using the Docker API to manage a Docker
environment. The user interactions with specific resources (containers, networks, volumes and images) are limited to
those available on the node targeted by the Docker API request.
Docker Swarm mode introduces a concept which is the clustering of Docker nodes. It also adds services, tasks, configs
and secrets which are cluster-aware resources. Cluster-aware means that you can query for a list of services or inspect
a task inside any node on the cluster, as long as you’re executing the Docker API request on a manager node.
Containers, networks, volumes and images are node specific resources, not cluster-aware. When you, for example,
want to list all the volumes available on a node inside your cluster, you will need to send a query to that specific node.
The purpose of the agent aims to allow previously node specific resources to be cluster-aware. All while keeping the
Docker API request format. As aforementioned, this means that you only need to execute one Docker API request to
retrieve all these resources from every node inside the cluster. In all bringing a better Docker user experience when
managing Swarm clusters.
4.2 Deployment
Have a look at the deployment documentation Inside a Swarm cluster to quickly deploy the agent and a Portainer
instance inside a Swarm cluster via docker stack deploy.
15
Portainer Documentation, Release 1.22.1
˓→\pipe\docker_engine,target=\\.\pipe\docker_engine portainer/agent:windows1803-amd64
Note: If you’re using Windows server 1803, you might need to open up DNS ports to
support the DNS resolution of tasks.portainer_agent. See: https://success.docker.com/article/
swarm-internal-dns-is-inaccessible-on-windows-server-1803
If you want to connect an existing Portainer instance to an agent, you can choose the Agent environment type when
creating a new endpoint.
Ensure when deploying the agent, that you expose the Agent’s port inside your Swarm cluster, and that the mode is set
to host (default port is 9001):
16 Chapter 4. Agent
Portainer Documentation, Release 1.22.1
Note: Please be aware that this could potentially open up the Agent for use by anybody in case the Docker host is
reachable from the internet. Publishing the Agent port 9001 in host mode basically means opening up this port in the
Docker hosts firewall for all interfaces. Therefore it is highly recommended to use the AGENT_SECRET environment
variable to define a shared secret, see Shared secret. The Agent implements the Trust On First Use (TOFU) principle,
so only the first Portainer to connect will be able to use it, but you want to avoid an attacker beating you to it.
You can then use the address of any node in your cluster (with the agent port) inside the Agent URL field.
Alternatively, you can deploy the agent using the following stack:
version: '3.2'
services:
agent:
image: portainer/agent
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes
ports:
- target: 9001
published: 9001
protocol: tcp
mode: host
networks:
- portainer_agent
deploy:
mode: global
placement:
constraints: [node.platform.os == linux]
networks:
portainer_agent:
driver: overlay
attachable: true
Note: In case you are running only a single Agent cluster in the same Swarm overlay network as your Portainer
instance, you can just omit publishing the Agent port 9001. Portainer and the Agents will be able to communicate
with each other inside the same overlay network and there is no need for the Agents to be accessible from the outside.
4.3 Configuration
You can use variant agent configurations to achieve different setups or enable specific features.
4.3. Configuration 17
Portainer Documentation, Release 1.22.1
By default, the agent will register the first Portainer instance that connects to it and prevent connections from any other
instance after that.
To bypass this security mechanism, Portainer and the agent can be configured at deployment time to use a shared
secret. This configuration allows multiple Portainer instances to connect to the same agent endpoint.
The AGENT_SECRET environment variable can be used to define the shared secret.
When deploying the agent as a service:
version: '3.2'
services:
agent:
image: portainer/agent
environment:
AGENT_SECRET: mysecrettoken
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes
ports:
- target: 9001
published: 9001
protocol: tcp
mode: host
networks:
- portainer_agent
deploy:
mode: global
placement:
constraints: [node.platform.os == linux]
networks:
portainer_agent:
driver: overlay
attachable: true
˓→data:/data portainer/portainer
18 Chapter 4. Agent
Portainer Documentation, Release 1.22.1
version: '3.2'
services:
agent:
image: portainer/agent
environment:
CAP_HOST_MANAGEMENT: 1
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes
- /:/host
ports:
- target: 9001
published: 9001
protocol: tcp
mode: host
networks:
- portainer_agent
deploy:
mode: global
placement:
constraints: [node.platform.os == linux]
networks:
portainer_agent:
driver: overlay
attachable: true
You can change the configuration of the agent by using environment variables.
The following environment variables can be tuned:
• AGENT_PORT: Agent port (default: 9001)
• LOG_LEVEL: Agent log level (default: INFO)
• AGENT_CLUSTER_ADDR: Address used by each agent to form a cluster.
• AGENT_SECRET: Shared secret used to authorize Portainer instances to connect to the agent
• CAP_HOST_MANAGEMENT: Enable host management features by setting the value to 1
4.3. Configuration 19
Portainer Documentation, Release 1.22.1
4.4 Usage
4.4.1 API
If you want to use the Portainer API to query containers running on a specific node inside a Swarm cluster and when
using the Portainer agent setup, you can specify the X-PortainerAgent-Target header in the HTTP request to
target a specific node in the cluster. The value must be set to the name of a specific node that can be retrieved via the
NodeName property when querying cluster resources (containers, volumes. . . ).
20 Chapter 4. Agent
CHAPTER 5
External endpoints
[
{
"Name": "my-first-endpoint",
"URL": "tcp://myendpoint.mydomain:2375"
},
{
"Name": "my-second-endpoint",
"URL": "tcp://mysecondendpoint.mydomain:2375",
"TLS": true,
"TLSSkipVerify": true,
"TLSCACert": "/tmp/ca.pem",
"TLSCert": "/tmp/cert.pem",
"TLSKey": "/tmp/key.pem"
}
]
{
"Name": "my-secure-endpoint",
"URL": "tcp://myendpoint.mydomain:2375",
"TLS": true,
"TLSCACert": "/tmp/ca.pem",
"TLSCert": "/tmp/cert.pem",
(continues on next page)
21
Portainer Documentation, Release 1.22.1
5.1.1 Name
Name of the endpoint. Used to check if an endpoint already exists in the database during a synchronization request. It
will also be displayed in the UI.
This field is mandatory.
5.1.2 URL
5.1.3 TLS
Specify this field to true if you need to use TLS to connect to the endpoint. Defaults to false. When applying the
true value to this field, Portainer will expect the TLSCACertPath, TLSCertPath and TLSKeyPath fields to be defined
too.
This field is optional.
5.1.4 TLSSkipVerify
Specify this field to true if you want to skip server verification. Defaults to false.
This field is optional.
5.1.5 TLSCACert
5.1.6 TLSCert
5.1.7 TLSKey
When using the --external-endpoints flag, Portainer will read the specified JSON file at startup and automat-
ically create the endpoints.
Portainer will then read the file based on the interval defined in --sync-interval (every 60s by default) and will
automatically do the following:
• For each endpoint in the database, it will automatically merge any configuration find in the file using the enpoint
name as the comparison key
• If an endpoint exists in the database but is not present in the file, it will be removed from the database
• If an endpoint exists in the file but not in the database it will be created in the database
When using external endpoint management, endpoint management will via the UI will be disabled to avoid any pos-
sible configuration overwrite (the endpoints view is still accessible but will only display the list of endpoints without
giving the possibility to create/update endpoints). A simple warning message will be displayed in the endpoints view.
Templates
{
"type": 1,
"title": "Nginx",
"description": "High performance web server",
"logo": "https://cloudinovasi.id/assets/img/logos/nginx.png",
"image": "nginx:latest",
"ports": [
"8080:80/tcp",
"443/tcp"
]
}
6.1.1 type
Template type, valid values are: 1 (container), 2 (Swarm stack) or 3 (Compose stack).
NOTE: Type 3 (Compose stack) is limited to using the version: “2” stack format, this is a limitation of
docker/libcompose.
This field is mandatory.
25
Portainer Documentation, Release 1.22.1
6.1.2 title
6.1.3 description
6.1.4 image
The Docker image associated to the template. The image tag must be included.
This field is mandatory.
6.1.5 administrator_only
{
"administrator_only": true
}
6.1.6 name
6.1.7 logo
6.1.8 registry
The registry where the Docker image is stored. If not specified, Portainer will use the Dockerhub as the default registry.
This field is optional.
26 Chapter 6. Templates
Portainer Documentation, Release 1.22.1
6.1.9 command
The command to run in the container. If not specified, the container will use the default command specified in its
Dockerfile.
This field is optional.
Example:
{
"command": "/bin/bash -c \"echo hello\" && exit 777"
}
6.1.10 env
A JSON array describing the environment variables required by the template. Each element in the array must be a
valid JSON object.
An input will be generated in the templates view for each element in the array. Depending on the object properties,
different types of inputs can be generated (text input, select).
This field is optional.
Element format:
{
"name": "the name of the environment variable, as supported in the container image
˓→ (mandatory)",
"label": "label for the input in the UI (mandatory unless set is present)",
"description": "a short description for this input, will be available as a tooltip
˓→in the UI (optional)",
Example:
{
"env": [
{
"name": "MYSQL_ROOT_PASSWORD",
"label": "Root password",
"description": "Password used by the root user."
},
{
"name": "ENV_VAR_WITH_DEFAULT_VALUE",
"default": "default_value",
"preset": true
},
{
"name": "ENV_VAR_WITH_SELECT_VALUE",
"label": "An environment variable",
"description": "A description for this env var",
"select": [
{
"text": "Yes, I agree",
"value": "Y",
(continues on next page)
6.1.11 network
{
"network": "host"
}
6.1.12 volumes
A JSON array describing the associated volumes of the template. Each element in the array must be a valid JSON
object that has a required container property.
For each element in the array, a Docker volume will be created and associated when starting the container. If a bind
property is defined it will be used as the source of a bind mount. If a readonly property is is defined and true, the
volume will be mounted in read-only mode.
This field is optional.
Example:
{
"volumes": [
{
"container": "/etc/nginx"
},
{
"container": "/usr/share/nginx/html",
"bind": "/var/www",
"readonly": true
}
]
}
28 Chapter 6. Templates
Portainer Documentation, Release 1.22.1
6.1.13 ports
A JSON array describing the ports exposed by template. Each element in the array must be a valid JSON string
specifying the port number in the container and the protocol.
It can be optionally prefixed with the port that must be mapped on the host in the port: form.
If the host port is not specified, the Docker host will automatically assign one when starting the container.
This field is optional.
Example:
{
"ports": ["8080:80/tcp", "443/tcp"]
}
6.1.14 labels
A JSON array describing the labels associated to the template. Each element in the array must be a valid JSON object
with two properties name and value.
This field is optional.
Example:
{
"labels": [
{ "name": "com.example.vendor", "value": "Acme" },
{ "name": "com.example.license", "value": "GPL" },
{ "name": "com.example.version", "value": "1.0" }
]
}
6.1.15 privileged
Should the container be started in privileged mode. Boolean, will default to false if not specified.
This field is optional.
{
"privileged": true
}
6.1.16 interactive
Should the container be started in foreground (equivalent of -i -t flags). Boolean, will default to false if not
specified.
This field is optional.
{
"interactive": true
}
6.1.17 restart_policy
Restart policy associated to the container. Value must be one of the following:
• no
• unless-stopped
• on-failure
• always
This field is optional. Will default to always if not specified.
{
"restart_policy": "unless-stopped"
}
6.1.18 hostname
{
"hostname": "mycontainername"
}
6.1.19 note
Usage / extra information about the template. This will be displayed inside the template creation form in the Portainer
UI.
Supports HTML.
This field is optional.
{
"note": "You can use this field to specify extra information. <br/> It supports <b>
˓→ HTML</b>."
}
6.1.20 platform
Supported platform. This field value must be set to linux or windows. This will display a small platform related icon
in the Portainer UI.
This field is optional.
{
"platform": "linux"
}
30 Chapter 6. Templates
Portainer Documentation, Release 1.22.1
6.1.21 categories
An array of categories that will be associated to the template. Portainer UI category filter will be populated based on
all available categories.
This field is optional.
{
"categories": ["webserver", "open-source"]
}
{
"type": 2,
"title": "CockroachDB",
"description": "CockroachDB cluster",
"note": "Deploys an insecure CockroachDB cluster, please refer to <a href=\"https://
˓→www.cockroachlabs.com/docs/stable/orchestrate-cockroachdb-with-docker-swarm.html\"
"categories": ["database"],
"platform": "linux",
"logo": "https://cloudinovasi.id/assets/img/logos/cockroachdb.png",
"repository": {
"url": "https://github.com/portainer/templates",
"stackfile": "stacks/cockroachdb/docker-stack.yml"
}
}
6.2.1 type
Template type, valid values are: 1 (container), 2 (Swarm stack) or 3 (Compose stack).
A Swarm stack will be deployed using the equivalent of docker stack deploy whereas a Compose stack will
be deployed using the equivalent of docker-compose.
NOTE: Type 3 (Compose stack) is limited to using the version: “2” stack format, this is a limitation of
docker/libcompose.
This field is mandatory.
6.2.2 title
6.2.3 description
6.2.4 repository
A JSON object describing the public git repository from where the stack template will be loaded. It indicates the URL
of the git repository as well as the path to the Compose file inside the repository.
Element format:
{
"url": "URL of the public git repository (mandatory)",
"stackfile": "Path to the Compose file inside the repository (mandatory)",
}
Example:
{
"url": "https://github.com/portainer/templates",
"stackfile": "stacks/cockroachdb/docker-stack.yml"
}
6.2.5 administrator_only
{
"administrator_only": true
}
6.2.6 name
6.2.7 logo
32 Chapter 6. Templates
Portainer Documentation, Release 1.22.1
6.2.8 env
A JSON array describing the environment variables required by the template. Each element in the array must be a
valid JSON object.
An input will be generated in the templates view for each element in the array. Depending on the object properties,
different types of inputs can be generated (text input, select).
This field is optional.
Element format:
{
"name": "the name of the environment variable, as supported in the container image
˓→ (mandatory)",
"label": "label for the input in the UI (mandatory unless set is present)",
"description": "a short description for this input, will be available as a tooltip
˓→in the UI (optional)",
Example:
{
"env": [
{
"name": "MYSQL_ROOT_PASSWORD",
"label": "Root password",
"description": "Password used by the root user."
},
{
"name": "ENV_VAR_WITH_DEFAULT_VALUE",
"default": "default_value",
"preset": true
},
{
"name": "ENV_VAR_WITH_SELECT_VALUE",
"label": "An environment variable",
"description": "A description for this env var",
"select": [
{
"text": "Yes, I agree",
"value": "Y",
"default": true
},
{
"text": "No, I disagree",
"value": "N"
},
{
"text": "Maybe",
"value": "YN"
}
],
"description": "Some environment variable."
}
(continues on next page)
6.2.9 note
Usage / extra information about the template. This will be displayed inside the template creation form in the Portainer
UI.
Supports HTML.
This field is optional.
{
"note": "You can use this field to specify extra information. <br/> It supports <b>
˓→ HTML</b>."
}
6.2.10 platform
Supported platform. This field value must be set to linux or windows. This will display a small platform related icon
in the Portainer UI.
This field is optional.
{
"platform": "linux"
}
6.2.11 categories
An array of categories that will be associated to the template. Portainer UI category filter will be populated based on
all available categories.
This field is optional.
{
"categories": ["webserver", "open-source"]
}
The simplest way to use your own templates is to bind mount your own template file directly into the Portainer
container, see Configuration.
You can also build your own container that will use Nginx to serve the templates definitions.
Clone the Portainer templates repository, edit the templates file, build and run the container:
34 Chapter 6. Templates
Portainer Documentation, Release 1.22.1
36 Chapter 6. Templates
CHAPTER 7
Troubleshooting
Portainer is built to run on Docker. If Docker is not configured correctly, then this can cause issues that appear to be
coming from Portainer.
The first thing to look at whether Docker is actually functioning correctly on your system.
$ docker version
The above command should have returned information about Docker running on your system. Below is a snippet of
what this may look like.
$ Client: Docker Engine - Community
Version: 19.03.3
API version: 1.40
Go version: go1.12.10
Git commit: a872fc2f86
Built: Tue Oct 8 00:59:59 2019
OS/Arch: linux/amd64
Experimental: false
37
Portainer Documentation, Release 1.22.1
• 2377/tcp
Next, make sure you are using the --advertise-addr option.
• When creating the cluster via docker swarm init, use --advertise-addr with either the private IP
address or NIC name directly (--advertise-addr eth1 for example)
• When joining a cluster on worker nodes via docker swarm join, use --advertise-addr the same as
above with either private IP address or NIC name directly
38 Chapter 7. Troubleshooting
CHAPTER 8
Contribute
Use the following instructions and guidelines to contribute to the Portainer project.
8.1.1 Requirements
Ensure you have Docker, Node.js >= 6, yarn and Golang (>= 1.11) installed on your system.
8.1.2 Build
Checkout the project, set up the project inside your $GOPATH and go inside the root directory:
$ yarn
$ yarn start
Tip: The frontend application will be updated when you save your changes to any of the sources (app/**/*.js,
assets/css/app.css or index.html). Just refresh the browser.
39
Portainer Documentation, Release 1.22.1
This will create a local folder docs/build/html where you will find the generated static files for the documenta-
tion.
40 Chapter 8. Contribute
CHAPTER 9
Limitations
9.1 Docker
9.2 Swarm
41
Portainer Documentation, Release 1.22.1
• Linux arm64
• Linux ppc64le
• Linux s390x
• Windows amd64
• Darwin amd64
42 Chapter 9. Limitations
CHAPTER 10
FAQ
10.1 Contact us
If you are still experiencing issues after reading this FAQ, feel free to contact us via any one of the following channels:
• Email: [email protected]
• Slack
• Twitter
• GitHub
• The Portainer Website
At this stage, you cannot reset your password using Portainer if you have forgotten it. You can however ask another
Portainer admin to reset the password for you.
There is an open feature request for this functionality which can be tracked on our GitHub repository here.
When you see a stack file shown as limited in the Portainer UI, it is because Portainer does not have the related stack
file in it’s database. This is either because the stack was deployed outside of Portainer, or because Portainer has lost
it’s database.
If you wish to manage the stack file within Portainer, you will need to deploy it within Portainer so that the file is kept
in the database & ensure that the database is persisted.
43
Portainer Documentation, Release 1.22.1
If you have recently updated your version of Portainer, this is an indication that your browser is holding onto the
previous version number of Portainer in it’s cache. To properly clear your cache, you will need to go into the browser
settings and empty the cache.
Note: You can use Ctrl + shift + R on most browsers to load the specific page without cache, however you
will need to repeat this on each page of Portainer to load the changes.
Currently, it is not possible to activate extensions offline as Portainer runs a license check against our license verifica-
tion server. There is a feature request open for this offline activation functionality which can be tracked on our GitHub
repository here.
• As stated above, Portainer needs internet access to activate extensions. One way to test is to run a busybox
container and see if it can reach the internet via ping or curl.
• If Portainer can reach the internet then this is not the problem. If you have access to the Portainer data filesystem
you can check whether the extension binaries have been downloaded. Navigate to the filesystem in use by
Portainer and check the bin directory to make sure the extension has been downloaded. If there is no extensions
present, then there is an issue with Portainer downloading the extension.
• If the extensions are present, then you may have a permissions issue and they may not be able to run. Check to
make sure that they are executable.
10.7 Users have access to an endpoint, but they cannot see anything.
Why?
• By default all resources inside an endpoint are assigned to administrator only for security reasons. To give
non-admin users access you can use the access control widget within each resource to assign users ownership,
or you can make the resource public to give all users access.
• Alternatively, when using the Role Based Access Control (RBAC) extension you can assign users and teams a
role at the endpoint level. You can read more about the RBAC extension and it’s features here.
Note: The RBAC extension requires Portainer version 1.21.0 or newer.
Portainer as a Container: If you have not created a persistent volume for your Portainer container, then Portainer
data will be stored inside the Docker container. If the container is then restarted, you will lose all of your data.
Portainer as a Service: If you have not created a persistent volume for your Portainer service, then Portainer data will
be stored inside the Docker container created by the service. If the service is updated, you may lose your Portainer
configuration.
See Deployment on how to create a persistent volume. If you have a persistent volume, then the issue may be that
Portainer is not constrained to the node where the data is persisted. See the below section for more info.
Our recommended deployment stack file constrains Portainer to a manager node, when you have multiple managers
this will potentially become a problem. Each stack or service update action could move the Portainer container
between them, and you may see Portainer appear as a fresh install.
The solution is to constrain your Portainer container to the node where your Portainer data is being persisted.
• Step 1: Following deployment of our stack file you will need to find the hostname of the node where the Portainer
volume is being persisted. Within Portainer, navigate to the volumes view and note down the hostname of your
Portainer volume. In this example the hostname is owner.
Alternatively you can run docker node ls and note down the hostname of the node where your Portainer data is
persisted.
• Step 2: Navigate to the Service details view for your Portainer service & navigate to placement constraints.
• Step 3: Click the placement constraints button to add a new constraint and fill in node.hostname for the name
and the hostname you gathered previously for the value.
• Step 4. Click the Apply changes button to apply your constraint.
Portainer uses the library Libcompose to deploy stacks on a standalone host, this library has been depreciated by
Docker and the repository for it sits unmaintained. You can view this repository here.
You can either get the logs for Portainer from Portainer’s own GUI or from the Docker CLI on the command line.
Fig. 4: Navigating to the Container logs view for the Portainer container
• Step 2. Click on the copy button to copy the logs of the Portainer container to your clipboard.
Getting Portainer’s logs from the Docker CLI
• Step 1. Navigate to the commandline of a Docker manager node/ non-swarm Docker host and enter docker
ps -a to list all of the Docker containers.
• Step 2. Note down the CONTAINER_ID attribute of your Portainer container.
• Step 3. Enter the following command and the logs of the Portainer container will output to the commandline:
docker container logs CONTAINER_ID
If you deployed the recommended agent stack or manage the local endpoint, you will need to set a public IP on your
endpoint for published ports to work on services in Portainer.
How to set the public IP of an endpoint:
• Step 1: Go to endpoints view
• Step 2: Click on your endpoint to see it’s details
• Fill in the Public IP field for your endpoint like below:
For an agent endpoint, add the IP of one of the nodes from your cluster
For the local endpoint add the IP of the host
10.12. Published ports in the services view redirect me to about:blank#blocked, what can I do? 47
Portainer Documentation, Release 1.22.1
Clicking on the published port in the Services view should now correctly redirect you to the published port of your
service in the browser.
10.13 External endpoints are not working in the latest Portainer ver-
sion, is this a bug?
We are aware that the --external-endpoint feature is not working in some of the latest versions of Portainer.
If you require use of external endpoints, we recommend rolling back to Portainer version 1.21.0 until a fix has been
released.
10.14 Where can I find the source code of the Portainer agent?
The Portainer agent is now open source! You can find it’s source code here.
If you want to manage a local Docker environment with SELinux enabled, you’ll need to pass the --privileged
flag to the Docker run command when deploying Portainer:
˓→portainer/portainer
10.13. External endpoints are not working in the latest Portainer version, is this a bug? 49
Portainer Documentation, Release 1.22.1
With Portainer behind a proxy, some features requiring access to the Internet (such as Apps Templates) might be
unavailable. When running Portainer as a container, you can set the HTTP_PROXY and HTTPS_PROXY env vars to
specify which proxy should be used:
For examples on how to configure a reverse proxy to work with Portainer, you can refer to our example repo here.
Note: these are in no way production ready, and are intended solely for demonstration purposes.
10.17 How can I expose the Docker API over TCP so that Portainer
can communicate with my environment?
Portainer strongly recommend to deploy Portainer using our agent enabled deployment due to the risk involved with
exposing the Docker API. If for whatever reason it is not possible to configure Portainer with the Agent, you can
configure Portainer to communicate with the Docker API over the network (usually on TCP 2375, 2376 with TLS).
Refer to Daemon socket option in the Docker Reference and to Docker Engine on Windows.
This is a great blog post which gives instructions on how to set up Portainer on Windows Server 2016.
Note: this is applicable to Windows Server 2016 only.
10.19 How can I play with Portainer outside of the public demo?
In order for Portainer to be able to redirect you to your Docker host IP address and not the 0.0.0.0 address, you will
have to change the configuration of your Docker daemon and add the --ip option. Note: that you will have to restart
your Docker daemon for the changes to be taken in effect.
Have a look at the Docker documentation for more details.
• Depending on your issue, make sure you first check the Portainer documentation and our user guides to ensure
everything is configured correctly.
• The next thing is to check the logs of Portainer & the Portainer Agent. For instructions on how to do this, refer
to the Portainer logs section above.
• If you cannot see anything wrong with your configuration or anything in the container logs, then the next step is
to troubleshoot your environment.
Make sure that Docker is running with the command docker version.