Skip to content

mendelu/Docker build fails with permission denied when creating /install#1281

Merged
milanmajchrak merged 2 commits intocustomer/mendelufrom
mendelu/fix-docker-install-permissions
Mar 17, 2026
Merged

mendelu/Docker build fails with permission denied when creating /install#1281
milanmajchrak merged 2 commits intocustomer/mendelufrom
mendelu/fix-docker-install-permissions

Conversation

@Paurikova2
Copy link
Collaborator

Problem

During the Docker build process, the following error occurs:

mkdir: cannot create directory ‘/install’: Permission denied

This happens in the build stage when running:

RUN mkdir /install \
    && chown -Rv dspace: /install \
    && chown -Rv dspace: /app

Root Cause

The base image dspace/dspace-dependencies:dspace-9_x now runs as a non-root user (dspace) by default.
Because of this change, the container no longer has permission to create directories in the root filesystem (/), which causes the build to fail when attempting to create /install.

Fix

The issue was resolved by explicitly switching to the root user before creating the directory:

USER root
RUN mkdir /install \
    && chown -Rv dspace: /install \
    && chown -Rv dspace: /app
USER dspace

This allows the directory to be created with sufficient permissions, after which ownership is assigned back to the dspace user and the build continues securely as a non-root user.

Manual Testing (if applicable)

Copilot review

  • Requested review from Copilot

@Paurikova2
Copy link
Collaborator Author

Paurikova2 commented Mar 17, 2026

@milanmajchrak I checked the Dockerfile of dspace_9_x, and there are more changes: https://github.com/DSpace/DSpace/commits/dspace-9_x/Dockerfile
Do we want to cherry-pick them all? I think they are usefull.

Answer: we don't want it, but good point

@milanmajchrak milanmajchrak merged commit 39654ac into customer/mendelu Mar 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants