shyim / shopware

Shopware 6 Docker Image
https://hub.docker.com/r/shyim/shopware
MIT License
66 stars 13 forks source link

Issue using bin/console via CLI #27

Closed mateuszstonawski closed 2 years ago

mateuszstonawski commented 2 years ago

I am using the image in a docker-compose setup for local theme development. Therefore I am using the bin/console cache:clear command to clear the current cache with entering the container via CLI.

But there is a permission issue that I currently don't know how to fix. Always when I'm clearing the cache with that command and enter the website, I am getting a 500 Internal Server Error. When entering the /admin, I am getting the json response saying: Unable to create the cache directory (/var/www/html/var/cache/prod_h438eee902a83f223cb534a5e6ec3771f/twig/b3).

I already know that this has to be an issue with permissions but I could not find a working solution. I have already tried sudo chown -R www-data:www-data /var/www/html/ but it did not help.

When manually deleting the cache folder, the page loads again. But this seems not to be a clean work flow.

Did someone have the same issue and knows a solution?

shyim commented 2 years ago

You could join the container as user 1000

docker exec -u 1000 my-container ash

mateuszstonawski commented 2 years ago

Then it is not letting me use the bin/console cache:clear command. With throwing the "same" error: Unable to write in the "/var/www/html/var/cache/prod_h438eee902a83f223cb534a5e6ec3771f" directory.

shyim commented 2 years ago

Maybe because the cache folder is already wrong written. chown -R 1000;1000 /var/www/html don't fix it?

mateuszstonawski commented 2 years ago

Ah nice, it seems that chown -R 1000 /var/www/html now helped, so that I could use docker exec -itu 1000 my-container /bin/sh and then bin/console cache:clear. The frontend is then loading like it should.

Thanks for your quick help. :)