Docker Setup on Windows - [Warning] chmod(): Operation not permitted

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version: 4.7

I am trying to set up SilverStripe with Docker for development. On MacOs it was no problem during setup but on Windows I get this warning:

While troubleshooting, I came up with several solutions that said it was a permission thing. I tried to give the /public/assests folder and also the complete /public order the correct permissions, but failed. Or rather, when I look at the permissions, I have the feeling that they are assigned correctly anyway:
grafik

My Dockerfile:

FROM brettt89/silverstripe-web:7.4-apache
ENV DOCUMENT_ROOT /var/www/html/public
COPY . $DOCUMENT_ROOT
WORKDIR $DOCUMENT_ROOT

Silverstripe Part of my docker-compose.yml:
(Additionally I have Images for the database - mysql:5.7 and phpmyadmin - which I can access without problems)

services:
  silverstripe:
    build: .
    volumes:
      - .:/var/www/html
    ports:
      - 1000:80
    depends_on:
      - database
    environment:
      - DOCUMENT_ROOT=/var/www/html/public
      - SS_TRUSTED_PROXY_IPS=*
      - SS_ENVIRONMENT_TYPE=dev
      - SS_DATABASE_SERVER=database
      - SS_DATABASE_NAME=silverstripe
      - SS_DATABASE_USERNAME=root
      - SS_DATABASE_PASSWORD=
      - SS_DEFAULT_ADMIN_USERNAME=admin
      - SS_DEFAULT_ADMIN_PASSWORD=password

I am new to Docker. For the setup I followed the documentation of brettt89/silverstripe-web and as mentioned above it also worked on Mac, the permissions seem to be correct.

Does anyone have a tip for me on how to solve this problem? I am grateful for any advice

It’s not so much a permissions problem as it is an ownership one. In order to perform the chmod() operation, the system user needs to either own the directories in question, or have sufficient super-user privileges. The directories you show seem to be owned by the root user… if the webserver user is trying to chmod them, then it probably doesn’t have sufficient privileges.

I’m not sure of the specifics of the set up you have, so I can’t offer an exact solution… but the above is most likely the cause. If we assume that the webserver user is www-data, then the following would probably cure your issue:

chown -R www-data /var/www/public

That sets the public directory to be owned by the webserver, allowing it to perform the operations it needs.

Thank you! That worked