#!/bin/bash
DOCKER_PATH=/volume1/docker/OnlyOffice
CONTAINER_IMAGE="onlyoffice/communityserver"
#CONTAINER_IMAGE="onlyoffice/documentserver"
CONTAINER_NAME="OnlyOfficeSRV"
MYJWTSECRET="[Security-code]"
if [ "$(docker ps -aq -f name=^/${CONTAINER_NAME}$)" ]; then
echo "Container ${CONTAINER_NAME} existiert bereits. Wird entfernt..."
# Stoppen des Containers (falls er läuft)
docker stop ${CONTAINER_NAME}
# Entfernen des Containers
docker rm ${CONTAINER_NAME}
echo "Container ${CONTAINER_NAME} wurde entfernt."
fi
sudo docker run --name $CONTAINER_NAME --privileged \
--mount type=bind,source=$DOCKER_PATH/data,target=/var/www/onlyoffice/Data \
--mount type=bind,source=$DOCKER_PATH/logs,target=/var/log/onlyoffice \
--mount type=bind,source=$DOCKER_PATH/letsencrypt,target=/etc/letsencrypt \
--mount type=bind,source=$DOCKER_PATH/cgroup,target=/sys/fs/cgroup \
--mount type=bind,source=$DOCKER_PATH/nonexistent,target=/nonexistent \
--network=net188-1 --ip=192.168.1.xx -i -t -d -p 80:80 -p 443:443 --restart=always -e JWT_SECRET=$MYJWTSECRET $CONTAINER_IMAGE
echo "Container ${CONTAINER_NAME} gestartet."