fix the mastercontainer

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2021-12-03 13:13:51 +01:00
parent 95145d9b15
commit e7ff0e2615
3 changed files with 15 additions and 16 deletions

View file

@ -28,7 +28,8 @@ RUN curl "https://caddyserver.com/api/download?os=linux&arch=amd64" -o "/usr/bin
RUN cd /var/www/docker-aio; \
git clone https://github.com/nextcloud/all-in-one.git .; \
chmod 770 -R ./
chmod 770 -R ./; \
chown www-data:www-data -R ./
RUN mkdir -p /etc/apache2/certs && \
cd /etc/apache2/certs && \

View file

@ -2,6 +2,6 @@
set -eu
while true; do
php /var/www/docker-aio/php/src/Cron/cron.php
sudo -u www-data php /var/www/docker-aio/php/src/Cron/cron.php
sleep 1d
done

View file

@ -10,27 +10,17 @@ print_green() {
if ! [ -a "/var/run/docker.sock" ]; then
echo "Docker socket is not available. Cannot continue."
exit 1
elif ! test -r /var/run/docker.sock; then
elif ! sudo -u www-data test -r /var/run/docker.sock; then
echo "Trying to fix docker.sock permissions internally..."
GROUP="$(stat -c '%g' /var/run/docker.sock)"
groupadd -g "$GROUP" docker && \
usermod -aG docker root
if ! test -r /var/run/docker.sock; then
echo "Docker socket is not readable by the root user. Cannot continue."
usermod -aG docker www-data
if ! sudo -u www-data test -r /var/run/docker.sock; then
echo "Docker socket is not readable by the www-data user. Cannot continue."
exit 1
fi
fi
# Adjust permissions for all instances
chown root:root -R /mnt/docker-aio-config
chmod 770 -R /mnt/docker-aio-config
# Check if volume is writeable
if ! [ -w /mnt/docker-aio-config ]; then
echo "/mnt/docker-aio-config is not writeable."
exit 1
fi
# Check if api version is supported
API_VERSION_FILE="$(find ./ -name DockerActionManager.php | head -1)"
API_VERSION="$(grep -oP 'const API_VERSION.*\;' "$API_VERSION_FILE" | grep -oP [0-9]+.[0-9]+ | head -1)"
@ -50,6 +40,14 @@ fi
mkdir -p /mnt/docker-aio-config/data/
mkdir -p /mnt/docker-aio-config/session/
mkdir -p /mnt/docker-aio-config/caddy/
mkdir -p /mnt/docker-aio-config/certs/
# Adjust permissions for all instances
chmod 770 -R /mnt/docker-aio-config
chown www-data:www-data -R /mnt/docker-aio-config/data/
chown www-data:www-data -R /mnt/docker-aio-config/session/
chown root:root -R /mnt/docker-aio-config/caddy/
chown root:root -R /mnt/docker-aio-config/certs/
# Adjust certs
GENERATED_CERTS="/mnt/docker-aio-config/certs"