serversideup/docker-php

Debug mode permission denied

Closed this issue · 2 comments

Affected Docker Images

serversideup/php:beta-7.4-cli-alpine
serversideup/php:beta-7.4-fpm-nginx-alpine
Possibly other images

Docker Labels of the affected images

serversideup/php:beta-7.4-fpm-nginx-alpine

{
  "org.opencontainers.image.authors": "Jay Rogers (@jaydrogers)",
  "org.opencontainers.image.description": "Supercharge your PHP experience. Based off the offical PHP images, serversideup/php includes pre-configured PHP extensions and settings for enhanced performance and security. Optimized for Laravel and WordPress.",
  "org.opencontainers.image.documentation": "https://serversideup.net/open-source/docker-php/docs/",
  "org.opencontainers.image.licenses": "GPL-3.0-or-later",
  "org.opencontainers.image.source": "https://github.com/serversideup/docker-php",
  "org.opencontainers.image.title": "serversideup/php ()",
  "org.opencontainers.image.url": "https://serversideup.net/open-source/docker-php/",
  "org.opencontainers.image.vendor": "ServerSideUp",
  "org.opencontainers.image.version": "v3.0.0-beta4"
}

serversideup/php:beta-7.4-cli-alpine

{
  "org.opencontainers.image.authors": "Jay Rogers (@jaydrogers)",
  "org.opencontainers.image.description": "Supercharge your PHP experience. Based off the offical PHP images, serversideup/php includes pre-configured PHP extensions and settings for enhanced performance and security. Optimized for Laravel and WordPress.",
  "org.opencontainers.image.documentation": "https://serversideup.net/open-source/docker-php/docs/",
  "org.opencontainers.image.licenses": "GPL-3.0-or-later",
  "org.opencontainers.image.source": "https://github.com/serversideup/docker-php",
  "org.opencontainers.image.title": "serversideup/php ()",
  "org.opencontainers.image.url": "https://serversideup.net/open-source/docker-php/",
  "org.opencontainers.image.vendor": "ServerSideUp",
  "org.opencontainers.image.version": "v3.0.0-beta4"
}

Current Behavior

When running this image with environment variable LOG_OUTPUT_LEVEL set to debug, I get these error messages:
serversideup/php:beta-7.4-fpm-nginx-alpine

Docker user:   www-data
Docker uid:    82
Docker gid:    82
OPcache:       ✅ Enabled
/etc/s6-overlay/scripts/1-debug-mode: line 11: can't create /usr/local/etc/php/php.ini: Permission denied
/etc/s6-overlay/scripts/1-debug-mode: line 16: can't create /usr/local/etc/php-fpm.d/zzz-fpm-debug.conf: Permission denied
ℹ️ NOTICE (debug-mode): INI - display_errors has been set to "On".
ℹ️ NOTICE (debug-mode): FPM - display_errors has been set to "On"
ℹ️ NOTICE (debug-mode): INI - display_startup_errors has been set to "On".
/etc/s6-overlay/scripts/1-debug-mode: line 11: can't create /usr/local/etc/php/php.ini: Permission denied
ℹ️ NOTICE (debug-mode): FPM - display_startup_errors has been set to "On"
ℹ️ NOTICE (debug-mode): INI - error_reporting has been set to "32767".
ℹ️ NOTICE (debug-mode): FPM - error_reporting has been set to "32767"
/etc/s6-overlay/scripts/1-debug-mode: line 16: can't create /usr/local/etc/php-fpm.d/zzz-fpm-debug.conf: Permission denied
/etc/s6-overlay/scripts/1-debug-mode: line 11: can't create /usr/local/etc/php/php.ini: Permission denied
/etc/s6-overlay/scripts/1-debug-mode: line 16: can't create /usr/local/etc/php-fpm.d/zzz-fpm-debug.conf: Permission denied

serversideup/php:beta-7.4-cli-alpine

Docker user:   www-data
Docker uid:    82
Docker gid:    82
OPcache:       ✅ Enabled
'
+ '[' 1 '=' 0 ]
+ IFS= read -r f
+ '[' -e /etc/entrypoint.d/1-debug-mode.sh ]
+ . /etc/entrypoint.d/1-debug-mode.sh
+ script_name=debug-mode
+ '[' false '=' false ]
+ '[' debug '=' debug ]
+ set_php_ini display_errors On
+ php_ini_setting=display_errors
+ php_ini_value=On
+ php_ini_debug_file=/usr/local/etc/php/php.ini
+ php_fpm_debug_conf_file=/usr/local/etc/php-fpm.d/zzz-fpm-debug.conf
/usr/local/bin/docker-php-serversideup-entrypoint: /etc/entrypoint.d/1-debug-mode.sh: line 11: can't create /usr/local/etc/php/php.ini: Permission denied

Expected Behavior

To not have permission denied

Steps To Reproduce

  1. Dockerfile
#############################
# CLI
#############################
ARG NO_DEV=false
FROM serversideup/php:beta-7.4-cli-alpine as cli
WORKDIR $APP_BASE_DIR
ENV COMPOSER_CACHE_DIR=/dev/null

USER root
RUN docker-php-serversideup-dep-install-alpine ffmpeg && \
    install-php-extensions gd exif
USER www-data

COPY --chown=www-data:www-data  . ./
RUN if [ "$NO_DEV" = "true" ]; then \
    composer install --no-scripts --no-dev --optimize-autoloader --no-interaction --no-ansi --no-progress; \
    else \
    composer install --no-scripts --optimize-autoloader --no-interaction --no-ansi --no-progress; \
    fi

#############################
# FPM-NGINX
#############################
FROM serversideup/php:beta-7.4-fpm-nginx-alpine as fpm-nginx
WORKDIR $APP_BASE_DIR
ENV COMPOSER_CACHE_DIR=/dev/null

USER root
RUN docker-php-serversideup-dep-install-alpine ffmpeg && \
    install-php-extensions gd exif
USER www-data

COPY --from=cli --chown=www-data:www-data $APP_BASE_DIR/ ./
  1. docker-compose.yml
volumes:
  storage:

networks:
  traefik:
    external: true
  databases_mariadb:
    external: true

services:
  app:
    image: registry.itcentar.rs/oneview:fpm-nginx-${DEPLOYMENT_ENV}
    volumes:
      - storage:/var/www/html/storage
    restart: unless-stopped
    networks:
      - databases_mariadb
      - traefik
    environment:
      - AUTORUN_ENABLED=${AUTORUN_ENABLED:-true}
      - AUTORUN_LARAVEL_MIGRATION=${AUTORUN_LARAVEL_MIGRATION:-true}
      - AUTORUN_LARAVEL_CONFIG_CACHE=${AUTORUN_LARAVEL_CONFIG_CACHE:-false}
      - AUTORUN_LARAVEL_EVENT_CACHE=${AUTORUN_LARAVEL_EVENT_CACHE:-false}
      - AUTORUN_LARAVEL_ROUTE_CACHE=${AUTORUN_LARAVEL_ROUTE_CACHE:-false}
      - AUTORUN_LARAVEL_VIEW_CACHE=${AUTORUN_LARAVEL_VIEW_CACHE:-false}
      - PHP_OPCACHE_ENABLE=${PHP_OPCACHE_ENABLE:-1}
      - LOG_OUTPUT_LEVEL=${LOG_OUTPUT_LEVEL:-debug}
    labels:
      - traefik.enable=true
      - traefik.http.routers.oneview-be-${DEPLOYMENT_ENV}.rule=Host(`${URL}`)
      - traefik.http.routers.oneview-be-${DEPLOYMENT_ENV}.tls=true
      - traefik.http.routers.oneview-be-${DEPLOYMENT_ENV}.tls.certresolver=production
      - traefik.http.services.oneview-be-${DEPLOYMENT_ENV}.loadbalancer.server.port=8080

  queue:
    image: registry.itcentar.rs/oneview:cli-${DEPLOYMENT_ENV}
    volumes:
      - storage:/var/www/html/storage
    networks:
      - databases_mariadb
    command: php artisan queue:work --sleep=3 --tries=3
    restart: unless-stopped
    environment:
      - AUTORUN_ENABLED=${AUTORUN_ENABLED:-true}
      - AUTORUN_LARAVEL_MIGRATION=${AUTORUN_LARAVEL_MIGRATION:-false}
      - AUTORUN_LARAVEL_CONFIG_CACHE=${AUTORUN_LARAVEL_CONFIG_CACHE:-false}
      - AUTORUN_LARAVEL_EVENT_CACHE=${AUTORUN_LARAVEL_EVENT_CACHE:-false}
      - AUTORUN_LARAVEL_ROUTE_CACHE=${AUTORUN_LARAVEL_ROUTE_CACHE:-false}
      - AUTORUN_LARAVEL_VIEW_CACHE=${AUTORUN_LARAVEL_VIEW_CACHE:-false}
      - PHP_OPCACHE_ENABLE=${PHP_OPCACHE_ENABLE:-1}
      - LOG_OUTPUT_LEVEL=${LOG_OUTPUT_LEVEL:-debug}

Host Operating System

Ubuntu 22.04

Docker Version

24.0.6

Anything else?

No response

Thanks for the detailed report! I'll work on a fix and will keep you posted 👍

🥳 This is fixed

I just pushed a fix for this and it should be made available shortly! It's building on our main branch now, which will publish it to our php-dev images: https://hub.docker.com/r/serversideup/php-dev

Tracking the build

The build process takes about an hour, but you can check its status here:

https://github.com/serversideup/docker-php/actions/runs/8870026059

Next release

Since it is merged to main, it will be included with our next release once that is ready.

Thanks for your detailed report! It made it very easy for me to understand the issue and get straight to the fix 👍