docker4php
docker4php copied to clipboard
Is there a way to make a named volume 'writable'?
For my Symfony site, I would like for the symfony cache to be a named volume. I think having it a part of my main workspace volume is causing occasional caching errors. But when I create a named volume I am given an error that the cache directory is not writable. Which I presume is because FPM is running as wodby
and not root
. Is there a way I can accomplish the goal of making the 'cache' be in docker only?
Host OS
macOS Monterey
Docker info output
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.7.1)
compose: Docker Compose (Docker Inc., v2.2.3)
scan: Docker Scan (Docker Inc., v0.16.0)
Server:
Containers: 9
Running: 7
Paused: 0
Stopped: 2
Images: 19
Server Version: 20.10.12
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc version: v1.0.2-0-g52b36a2
init version: de40ad0
Security Options:
seccomp
Profile: default
cgroupns
Kernel Version: 5.10.76-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
CPUs: 5
Total Memory: 1.942GiB
Name: docker-desktop
ID: BBRN:Y74T:T3HJ:AWYW:NO67:2DFV:AM7U:A2TK:VHHC:D3BE:SSJT:CHNC
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Docker compose file
version: "3"
services:
...
php:
image: wodby/php:$PHP_TAG
container_name: "${PROJECT_NAME}_php"
environment:
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
MAILER_DSN: smtp://mailhog:1025
DB_HOST: $DB_HOST
TEST_DB_HOST: $TEST_DB_HOST
DB_USER: $DB_USER
DB_PASSWORD: $DB_PASSWORD
DB_NAME: $DB_NAME
PHP_FPM_USER: wodby
PHP_FPM_GROUP: wodby
DOCKER: 1
APP_ENV: dev
APP_DEBUG: 1
COMPOSER_MEMORY_LIMIT: -1
COMPOSER_PROCESS_TIMEOUT: 1200
# PHP_XDEBUG: 1
PHP_XDEBUG_MODE: debug
PHP_XDEBUG_CLIENT_HOST: host.docker.internal # Docker 18.03+ Mac/Win
volumes:
- ./backend/:/var/www/html:cached
- ./backend/tests/:/var/www/html/backend/tests
- wb_backend_cache:/var/www/html/var/cache
...
volumes:
wb_backend_cache:
Logs output
[RuntimeException]
Unable to create the "cache" directory (/var/www/html/var/cache/dev).