I have a script
name: wordpress
services:
db:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
env_file:
- .env
volumes:
- ./db_data:/var/lib/mysql
phpmyadmin:
image: phpmyadmin:latest
ports:
- 8081:80
wordpress:
image: wordpress:latest
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: ${MYSQL_USER}
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
WORDPRESS_DB_NAME: ${MYSQL_DATABASE}
volumes:
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
- ./wp_content:/var/www/html/wp-content
volumes:
db_data:
wp_content: {}
On the host, the wp_content
directory has the rights of the running container. I am looking for a (universal) way to have the rights to perform operations on in the wp_content
directory. The quickest solution I could think of is the following:
sudo chown user: -R wp_content
The solution is even good (for a local solution), but you have to execute it every time you launch the container.
How can this be made better so that the wp_content directory can be used? Build your image with your own permissions?
RUN useradd -s /bin/bash user
USER user
Are there other, faster ways?