• Photo de Profil de moonlight

      moonlight a publié un message

      Il y a 7 mois

      I’ve seen a claim that a mismatch between the permissions of a mounted local directory and the container environment may cause WordPress to not be able to write to files properly. So, how do you properly configure the permissions of the mounted volume in the Docker Compose file, or manually adjust the permissions of the local directory with commands to ensure that users inside the container can access and manipulate these files properly?

      • Pour éviter les problèmes de permissions, vous pouvez synchroniser les ID d'utilisateur (UID) et les ID de groupe (GID) des utilisateurs du conteneur avec les informations d'utilisateur du système hôte dans le fichier docker-compose.yml.

        Exemple de configuration

        version : '3.9'

        les services :

        wordpress.

        image: wordpress:latest

        user: “1000:1000” # replace this with your local user ID and group ID

        volumes.

        – . /wordpress:/var/www/html

        environment: .

        WORDPRESS_DB_HOST: db

        WORDPRESS_DB_USER: wordpress

        WORDPRESS_DB_PASSWORD: wordpress

        WORDPRESS_DB_NAME: wordpress

        wordpress WORDPRESS_DB_NAME: wordpress

        image: mysql:5.7

        environment: MYSQL_ROOT_PASSWORD

        MYSQL_ROOT_PASSWORD: rootpassword

        MYSQL_DATABASE: wordpress

        MYSQL_USER: wordpress

        MYSQL_PASSWORD: wordpress

        MYSQL_PASSWORD: wordpress MYSQL_PASSWORD: wordpress

        – MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress

        volumes: db_data:/var/lib/mysql

        db_data: /var/lib/mysql

        Use the id command to check your local user and group IDs:

        id

        For example, uid=1000 and gid=1000 in the output represent your user ID and group ID.

        Replace these IDs with user: “1000:1000” to ensure that the container user and the host user are the same.