CLI configuration options

Configuration flags available at the command line

Flag
Description
--admin-password
Specifies a bcrypt hashed password for the admin user.
--admin-password-file
Specifies the path to the file containing the password for the admin user.
--bind
-p
Specifies the address and port from which to serve Portainer (default: :9000).
--data
-d
Specifes the directory where Portainer data will be stored (default: /data on Linux, C:\data on Windows).
--edge-compute
Automatically enables Edge Compute features.
--hide-label
-l
Hides containers with a specific label in the UI.
--host
-H
Specifies the Docker daemon endpoint.
--logo
Specifies the URL to the image to be displayed as a logo in the UI. If not specified, the Portainer logo is used instead.
--snapshot-interval
Specifies the time interval between two endpoint snapshot jobs expressed as a string. For example 30s, 5m, 1h… Supported by the time.ParseDuration method (default: 5m).
--ssl
The secure Portainer instance using SSL (default: false).
--sslcert
Specifies the path to the SSL certificate used to secure the Portainer instance (default: /certs/portainer.crt on Linux, C:\certs\portainer.crt on Windows).
--sslkey
Specifies the path to the SSL key used to secure the Portainer instance (default: /certs/portainer.key on Linux, C:\certs\portainer.key on Windows).
--templates
-t
Specifies the URL to the templates (apps) definitions.
--tlscacert
Specifies the path to the CA (default: /certs/ca.pem on Linux, C:\certs\ca.pem on Windows).
--tlscert
Specifies the path to the TLS certificate file (default: /certs/cert.pem, C:\certs\cert.pem on Windows).
--tlskey
Specifies the path to the TLS key (default: /certs/key.pem, C:\certs\key.pem on Windows).
--tlsverify
TLS support (default: false).
--tunnel-port
Specifies 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.

Creating an admin account and password

The commands in this section will automatically create an administrator account called admin with the password you specify.

Method 1: Creating the account from the command line

You can specify a bcrypt-encrypted password from the command line for the admin account. If you have installed the apache2-utils package, create the password using the following command:
1
htpasswd -nb -B admin "your-password" | cut -d ":" -f 2
Copied!
If your system does not have that command, use a container to run the command instead:
1
docker run --rm httpd:2.4-alpine htpasswd -nbB admin "your-password" | cut -d ":" -f 2
Copied!
Once the password has been created, specify the admin password from the command line by starting Portainer with the --admin-password flag:
1
docker run -d -p 9000:9000 -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ee --admin-password='$2y$05$8oz75U8m5tI/xT4P0NbSHeE7WyRzOWKRBprfGotwDkhBOGP/u802u'
Copied!

Method 2: Creating the account using a file

You can also store a plain text password inside a file and use the --admin-password-file flag. First, add the password to a file using the following example command as a guide:
1
echo -n mypassword > /tmp/portainer_password
Copied!
Next, start the Portainer container:
1
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-ee --admin-password-file /tmp/portainer_password
Copied!
This also works well with Docker Swarm and Docker Secrets:
1
echo -n mypassword | docker secret create portainer-pass -
Copied!
1
docker service create \
2
--name portainer \
3
--secret portainer-pass \
4
--publish 9000:9000 \
5
--publish 8000:8000 \
6
--replicas=1 \
7
--constraint 'node.role == manager' \
8
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
9
portainer/portainer-ee \
10
--admin-password-file '/run/secrets/portainer-pass' \
11
-H unix:///var/run/docker.sock
Copied!

Hiding specific containers

Portainer lets you hide containers with a specific label by using the -l flag. Here's an example showing a container labeled owner=acme:
1
docker run -d --label owner=acme nginx
Copied!
To hide this container, when starting Portainer add the -l owner=acme option on the CLI:
1
docker run -d -p 9000:9000 -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ee -l owner=acme
Copied!
To hide multiple containers, repeat the -l flag:
1
docker run -d -p 9000:9000 -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ee -l owner=acme -l service=secret
Copied!

Using your own logo

Images must be exactly 155px by 55px in size.
Replace our logo with your own using the --logo flag to specify the location of the image file:
1
docker run -d -p 9000:9000 -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ee --logo "https://www.docker.com/sites/all/themes/docker/assets/images/brand-full.svg"
Copied!
You can also update the logo in the Portainer UI (Settings menu).

Defining your own app templates

We suggest hosting template files on GitHub so Portainer can access them without authentication.
Portainer allows you to rapidly deploy containers using app templates. By default, Portainer templates will be used but you can also define your own.
Templates are loaded once when Portainer is first started. If you already deployed a Portainer instance then decide to use your own templates, you’ll need to clear the default templates either in the user interface or through the HTTP API. Use the --templates flag to specify a URL where the template file can be accessed via HTTP.
1
docker run -d -p 9000:9000 -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ee --templates http://my-host.my-domain/templates.json
Copied!
Last modified 9d ago