Skip to content

cannot create /etc/unit/config.d/config.json: Permission denied #318

Description

@Jackardios

Affected Docker Images

serversideup/php:beta-8.3-unit

Docker Labels of the affected images

No response

Current Behavior

after updating #311 an error appeared when starting the container:

/usr/local/bin/docker-php-serversideup-entrypoint: 57: /etc/entrypoint.d/10-init-unit.sh: cannot create /etc/unit/config.d/config.json: Permission denied
nit-unit: Processing /etc/unit/config.d/ssl-off.json.template → /etc/unit/config.d/config.json...

Снимок экрана 2024-04-23 в 00 14 08

Expected Behavior

The container should start without errors

Steps To Reproduce

  1. dockerfile:
# ======================================================================================================================
#                                                   --- Base ---
# ---------------  This stage install needed extenstions, plugins and add all needed configurations  -------------------
# ======================================================================================================================

FROM serversideup/php:beta-8.3-unit as base

USER root

# Install dependencies needed inside base image
RUN apt-get update && apt-get install -y \
    curl \
    vim \
    git \
    wget \
    zsh \
    default-mysql-client \
    && rm -rf /var/lib/apt/lists/*

# Install and enable PHP extensions
RUN install-php-extensions \
    apcu \
    bcmath \
    ctype \
    curl \
    exif \
    gd \
    imagick/imagick@master \
    intl \
    mbstring \
    opcache \
    pcntl \
    pdo_mysql \
    redis \
    zip

# Fix permission issues in development by setting the "www-data"
# user to the same user and group that is running docker.
ARG USER_ID
ARG GROUP_ID
RUN docker-php-serversideup-set-id www-data ${USER_ID}:${GROUP_ID}

USER www-data

# ======================================================================================================================
#                                                --- Development ---
# ======================================================================================================================

FROM base as development

COPY ./docker/php/config/php-config.base.ini /usr/local/etc/php/conf.d/php-config.base.ini
COPY ./docker/php/config/php-config.development.ini /usr/local/etc/php/conf.d/php-config.development.ini

WORKDIR /var/www/html

# ======================================================================================================================
#                                                --- Production ---
# ======================================================================================================================

FROM base as production

COPY ./docker/php/config/php-config.base.ini /usr/local/etc/php/conf.d/php-config.base.ini
COPY ./docker/php/config/php-config.production.ini /usr/local/etc/php/conf.d/php-config.production.ini

WORKDIR /var/www/html

# For security and isolation, instead of mounting the folder, we copy all files to the container
COPY --chown=www-data:www-data . /var/www/html

# Run composer install
RUN VIEW_COMPILED_PATH=./ composer install --optimize-autoloader --apcu-autoloader --no-dev -n --no-progress && \
    composer check-platform-reqs
  1. service in docker-compose:
services:
  php:
    build:
      context: .
      dockerfile: ./Dockerfile
      target: development
      args:
        USER_ID: ${USER_ID}
        GROUP_ID: ${GROUP_ID}
    restart: unless-stopped
    working_dir: /var/www/html
    depends_on:
      - mysql-test
      - mysql
      - elasticsearch
      - redis
    volumes:
      - .:/var/www/html
      - ~/.composer:/home/composer/.cache/composer
      - ~/.composer/auth.json:/config/composer/auth.json
      - ./vendor:/var/www/html/vendor:delegated
  1. run docker compose
USER_ID="$(id -u)" GROUP_ID="$(id -g)" docker compose up --build -d

Host Operating System

MacOS 14.3.1

Docker Version

24.0.6

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🧐 Bug: Needs ConfirmationSomething isn't working, but needs to be confirmed by a team member.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions