This is my docker-composer.yml
for wordpress:
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- ./all:/var/www/html
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- "8084:80"
links:
- db:db
volumes:
db_data: {}
The folder all
contains all the files that ship from the wordpress docker image. However, they all have user/group www-data:www-data
and the permission of the files is 644 and from folders 755, i.e. even if I add myself to the www-data
group I have no right to modfiy or create files.
My research:
I found at write in shared volumes docker that someone had the opposite problem, he created files and his docker image could not access it. The solution seems to be to run docker and create a file with user
www-data
- but I don't see how I can apply this to my problem.I tried to add
user: "1000:1000
in the worpdress service insidedocker-composer.yml
, in hope, that all file permissions set by docker would be from my user. However, I get 1000 lines of erros of this form:
wordpress_1 | tar: ./wp-admin: Cannot mkdir: Permission denied wordpress_1 | tar: ./wp-admin/options-reading.php: Cannot open: No such file or directory