Fork of https://github.com/softonic/portainer-endpoint
736
This image allows to auto register all the swarm nodes in a Portainer running in the same cluster and network.
You need to create a global service and pass some options and env vars.
HOST_HOSTNAME: (Optional) Just in case you want to change the mount point of the file that contains the name of the hostPORTAINER_ADDR: Name and port where Portainer is configuredPORTAINER_USER: Username used to login to PortainerPORTAINER_PASS: Password used to login to PortainerSLEEP_IF_WORKER: Seconds to wait before register the node if it's a workerThe SLEEP_IF_WORKER is useful to avoid that a worker is the first to register to Portainer, because it loads by default
the first registered endpoint, if it's a worker you won't have the cluster overview in a first sight.
This allows to register just the current node. You need to be sure that the portainer network is attachable.
docker container run \
--name portainer-endpoint \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
--mount type=bind,source=/etc/hostname,target=/etc/host_hostname \
--network portainer \
-e HOST_HOSTNAME=/etc/host_hostname \
-e PORTAINER_ADDR=portainer:9000 \
-e PORTAINER_USER=admin \
-e PORTAINER_PASS=12341234 \
softonic/portainer-endpoint
This allows to register each node in Portainer.
docker service create --with-registry-auth \
--name portainer-endpoint \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
--mount type=bind,source=/etc/hostname,target=/etc/host_hostname \
--network portainer \
--mode global \
-e HOST_HOSTNAME=/etc/host_hostname \
-e PORTAINER_ADDR=portainer:9000 \
-e PORTAINER_USER=admin \
-e PORTAINER_PASS=12341234 \
softonic/portainer-endpoint
You can use a Swarm Stack to deploy Portainer and the automatic registration feature. Just execute the stack file in a swarm cluster:
git clone [email protected]:softonic/portainer-endpoint.git
cd portainer-endpoint
export VOLUME_DRIVER=local
export PORTAINER_PASS=12341234
export PORTAINER_ENC_PASS=$(docker run --rm httpd:2.4-alpine htpasswd -nbB admin ${PORTAINER_PASS} | cut -d ":" -f 2)
echo $PORTAINER_PASS | docker secret create portainer_password.v1 --label portainer -
docker stack deploy --compose-file docker-compose.yml portainer
Once the stack is deployed and running you can go to the port 9000 on any of your cluster nodes to reach Portainer.
You'll see all the nodes in your cluster are already registered.
Content type
Image
Digest
Size
3.8 MB
Last updated
about 9 years ago
docker pull stempler/portainer-endpoint