Portainer
Using the
Portainer container management platform as a graphical user interface for Docker.
Specify the data directory
replace_data_directory
.
Choose a container name
replace_container
and
a volume name
replace_volume
.
No container ports are published, so specify the network
replace_network
defined to serve behind a reverse proxy.
Create the directory and the volume.
data_directory="replace_data_directory" # data_directory=/data/services
container=replace_container # container=portainer
volume=replace_volume # volume=portainer
network=replace_network # network=services
sudo mkdir --parents "$data_directory/portainer"
sudo chmod --recursive a+rwX "$data_directory/portainer/"
docker volume create \
--name $volume \
--driver local-persist \
--opt mountpoint="$data_directory/portainer/"
Configure the reverse proxy.
Put the
configuration file to the web server directory.
Set the Portainer hostname
replace_container
in the configuration file to forward requests to the container.
Apply the web server configuration.
container_caddy=replace_container_caddy # container_caddy=caddy
cp portainer.caddy "$data_directory/caddy/configuration/"
docker container restart $container_caddy
Start the container.
docker run --detach --restart unless-stopped \
--name $container \
--hostname $container \
--network $network \
--mount type=volume,source=$volume,destination=/data \
--mount type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock \
--mount type=bind,source=/etc/timezone,destination=/etc/timezone,readonly \
--mount type=bind,source=/etc/localtime,destination=/etc/localtime,readonly \
portainer/portainer-ce \
--host unix:///var/run/docker.sock
Access the site at the /portainer path and perform configurations.
Settings
Allow the collection of anonymous statistics
Authentication
Session lifetime
Password rules
Users
replace_login
Change user password