Start independently Portainer
This allows for simpler maintenance on the Portainer service when required.
This commit is contained in:
35
portainer.sh
Executable file
35
portainer.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2017-2018
|
||||
# Data Intensive Applications and Systems Labaratory (DIAS)
|
||||
# Ecole Polytechnique Federale de Lausanne
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Permission to use, copy, modify and distribute this software and its
|
||||
# documentation is hereby granted, provided that both the copyright notice
|
||||
# and this permission notice appear in all copies of the software, derivative
|
||||
# works or modified versions, and any portions thereof, and that both notices
|
||||
# appear in supporting documentation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. THE AUTHORS AND ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE
|
||||
# DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
|
||||
# USE OF THIS SOFTWARE.
|
||||
|
||||
# Import settings
|
||||
. ./settings.sh
|
||||
|
||||
# Permanent storage for Portainer
|
||||
test -d ${PORTAINER_DATA} \
|
||||
|| mkdir -p ${PORTAINER_DATA} \
|
||||
|| ( echo Failed to create ${PORTAINER_DATA}; exit 1 )
|
||||
|
||||
docker service create \
|
||||
--publish ${PORTAINER_PORT}:9000 \
|
||||
--constraint 'node.role == manager' \
|
||||
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
|
||||
--mount type=bind,src=${PORTAINER_DATA},dst=/data \
|
||||
--name portainer \
|
||||
${PORTAINER_IMAGE}${PORTAINER_VERSION}
|
||||
|
||||
@@ -28,23 +28,6 @@ set -e
|
||||
docker swarm init --advertise-addr=${MASTER_IP}
|
||||
)
|
||||
|
||||
# Portainer, a WebUI for Docker Swarm
|
||||
if ${PORTAINER_ENABLED}
|
||||
then
|
||||
test -d ${PORTAINER_DATA} \
|
||||
|| mkdir -p ${PORTAINER_DATA} \
|
||||
|| ( echo Failed to create ${PORTAINER_DATA}; exit 1 )
|
||||
|
||||
docker service create \
|
||||
--detach=true \
|
||||
--name portainer \
|
||||
--publish ${PORTAINER_PORT}:9000 \
|
||||
--constraint 'node.role == manager' \
|
||||
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
|
||||
--mount type=bind,src=${PORTAINER_DATA},dst=/data \
|
||||
${PORTAINER_IMAGE}${PORTAINER_VERSION}
|
||||
fi
|
||||
|
||||
docker network create \
|
||||
--driver=overlay \
|
||||
--opt encrypted \
|
||||
|
||||
Reference in New Issue
Block a user