Closed alibori closed 2 years ago
run 'php artisan storage:link' into your container .
This isn't a Voyager problem, or even a Laravel problem. Voyager (and Laravel) runs under the php-fpm process, which has a specific user ID it runs as. When creating files, effective permissions will be that of the user php-fpm is running as. If your host OS is a *nix variant, the file ownership info from the host will be the same inside the docker container. In your case, these IDs likely don't match.
You can confirm this by opening a shell into the docker container and checking file permissions/ownership on the directory where these images should be written to (likely /path/to/project/storage/app/public
). How to do this is not specific to Voyager and therefore left as an exercise for the reader. Solution will depend on specifically what you find, but is also not specific to Voyager
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Laravel version
8.54
PHP version
7.4-fpm-alpine
Voyager version
1.5
Database
mysql:5.7
Description
Hello! I'm developing a Laravel project with Voyager and I want to do it with Docker. When trying to upload a page image if the directory is created there isn't problem but if not it throws an error. Thanks in advance!
Steps to reproduce
I have this project structure:
My docker-compose.yml looks like this: `version: '3.7'
services: nginx: image: nginx:stable-alpine container_name: nginx restart: always ports:
laravel
mysql: image: mysql:5.7 container_name: mysql restart: always environment: MYSQL_DATABASE: homestead MYSQL_USER: homestead MYSQL_PASSWORD: secret MYSQL_ROOT_PASSWORD: admin.root ports:
laravel
php: build: context: . dockerfile: Dockerfile container_name: php volumes:
networks: laravel:`
My Dockerfile looks like this: `FROM php:7.4-fpm-alpine
Install dependencies
RUN apk add --no-cache \ jpegoptim optipng pngquant gifsicle \ curl \ libzip-dev
Setup GD extension
RUN apk add --no-cache \ freetype \ libjpeg-turbo \ libpng \ freetype-dev \ libjpeg-turbo-dev \ libpng-dev \ && docker-php-ext-configure gd \ --with-freetype=/usr/include/ \ --with-jpeg=/usr/include/ \ && docker-php-ext-install -j$(nproc) gd \ && docker-php-ext-enable gd \ && apk del --no-cache \ freetype-dev \ libjpeg-turbo-dev \ libpng-dev \ && rm -rf /tmp/* RUN docker-php-ext-configure zip RUN docker-php-ext-install zip RUN docker-php-ext-install mysqli pdo pdo_mysql exif bcmath`
Everything is working well except create a new directory like 'September2021' when I upload a new image.
Expected behavior
I want that Voyager can create the folder if it not exists.
Screenshots
No response
Additional context
No response