My main goal is to create a wordpress container on my linux machine for development on that container.
Therefore, I'm creating new volumes for the plugins
and themes
folders and even add read & write
permissions, with the :rw
option.
However, when I'm trying to create a new directory or file in those "volumes", I get an error message (especially in VS Code), that tells that I don't have the permission to add these volumes.
Moreover, the permissions based on the ll
command shows that the owner is the only one with the w
permissions. It means that I cannot use the group www-data
and add it to my user in order to edit those volumes.
When I'm trying to run chmod 766 themes plugins
, the volumes are not bind anymore, so this solution doesn't work.
I've searched the whole web (including stack overflow), but none of the answers didn't work for me, so I'm lost :(
Here are some details that can help you with finding solution, including the docker-compose.yml
file.
hello
A system error occurred (EACCES: permission denied, mkdir '~/Workspace/WordpressProject/themes/hello')
mkdir hello
in terminal, returns this errormkdir: cannot create directory ‘hello’: Permission denied
ll
command result for volumesdrwxr-xr-x 2 www-data www-data 4096 Jun 14 23:54 plugins/
drwxr-xr-x 5 www-data www-data 4096 May 17 22:00 themes/
version: '3'
services:
wordpress:
image: wordpress
links:
- mariadb:mysql
environment:
- WORDPRESS_DB_PASSWORD=${Database Name}
ports:
- "127.0.0.101:80:80"
hostname: ${Wordpress Host}
volumes:
- ./plugins:/var/www/html/wp-content/plugins:rw
- ./themes:/var/www/html/wp-content/themes:rw
restart: always
mariadb:
image: mariadb
environment:
- MYSQL_ROOT_PASSWORD=${Password}
- MYSQL_DATABASE=${Database Name}
volumes:
- ./database:/var/lib/mysql
restart: always
Please in VS terminal execute:
sudo chown -R $USER <directory_project>