Wordpress container running on mac cannot create theme directory on mounted path
Hi, I am running the following compose file with Docker Compose backed by Podman Machine on mac (Intel): services: db: image: docker.io/library/mariadb:10.5 environment: - MYSQL_DATABASE=mydb - MYSQL_USER=wpuser - MYSQL_PASSWORD=mypass - MYSQL_ROOT_PASSWORD=mypass volumes: - wpdb_vol:/var/lib/mysql wp: image: docker.io/library/wordpress:php8.2-apache environment: - WORDPRESS_DB_NAME=mydb - WORDPRESS_DB_USER=wpuser - WORDPRESS_DB_PASSWORD=mypass - WORDPRESS_DB_HOST=db depends_on: - db ports: - 8000:80 volumes: - .:/var/www/html - wp_uploads:/var/www/html/wp-content/uploads adminer: image: docker.io/library/adminer:4.6 ports: - 8080:8080 volumes: wp_uploads: {} wpdb_vol: {} When running the containers, in WordPress admin page, I cannot install a plugin. Basically, the container is not allowed to create directories under wp-content. It fails with permission error: "Could not create directory /var/www/html/wp-content/upgrade/oceanwp-3.4.4/oceanwp" I tried chmod 777 on all wp-content (with -r), but it didn't help. Not sure if this is a Podman issue or a due mechanism that needs to be properly handled. How can I fix this? Mehdi
On 02.06.23 at 19:22 Mehdi Haghgoo via Podman wrote:
volumes: - .:/var/www/html
I guess this is no typo, you are really using "." as volume for /var/www/html?
volumes: wp_uploads: {} wpdb_vol: {}
When running the containers, in WordPress admin page, I cannot install a plugin. Basically, the container is not allowed to create directories under wp-content. It fails with permission error: "Could not create directory /var/www/html/wp-content/upgrade/oceanwp-3.4.4/oceanwp"
I tried chmod 777 on all wp-content (with -r), but it didn't help.
I would try using a "real volume" (and not just ".") for /var/www/html. My guess would be that due to MacOS and Podman Machine (and not using Podman directly, like on Linux) this does not work. Kind Regards, Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
Hi Johannes, Thanks for the idea. I tried using absolute path in docker-compose.yaml, but it fails to launch the container with "Permission Denied" error saying that it cannot mkdir /Users. This is strange because the /Users directory should already exist on Podman machine. This is not an issue on fedora by the way when I run docker-compose. Any ideas? On Fri, Jun 16, 2023 at 9:35, Johannes Kastl<kastl@b1-systems.de> wrote: On 02.06.23 at 19:22 Mehdi Haghgoo via Podman wrote:
volumes: - .:/var/www/html
I guess this is no typo, you are really using "." as volume for /var/www/html?
volumes: wp_uploads: {} wpdb_vol: {}
When running the containers, in WordPress admin page, I cannot install a plugin. Basically, the container is not allowed to create directories under wp-content. It fails with permission error: "Could not create directory /var/www/html/wp-content/upgrade/oceanwp-3.4.4/oceanwp"
I tried chmod 777 on all wp-content (with -r), but it didn't help.
I would try using a "real volume" (and not just ".") for /var/www/html. My guess would be that due to MacOS and Podman Machine (and not using Podman directly, like on Linux) this does not work. Kind Regards, Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
On 17.06.23 at 05:00 Mehdi Haghgoo via Podman wrote:
Hi Johannes, Thanks for the idea. I tried using absolute path in docker-compose.yaml, but it fails to launch the container with "Permission Denied" error saying that it cannot mkdir /Users. This is strange because the /Users directory should already exist on Podman machine. This is not an issue on fedora by the way when I run docker-compose. Any ideas?
I have not used Podman machine, but IIRC it spins up a VM and then runs podman inside this VM. Not sure if it mounts the host's home directory (the one on your Mac) into the VM, so it can mount it into the container. Then I would try to use a named volume, without a path. This will work, I guess. But this does not get your local files into the container. Kind Regards, Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
On 6/19/23 00:55, Johannes Kastl wrote:
I have not used Podman machine, but IIRC it spins up a VM and then runs podman inside this VM. Not sure if it mounts the host's home directory (the one on your Mac) into the VM, so it can mount it into the container.
I'm not an expert in podman-on-mac, but I'm pretty sure I remember overhearing talk among the container's team that it does provide something to the VM. "From" or "to" where, I have no idea, sorry. Maybe a `podman machine ssh` and a `findmnt` might help locate it?
participants (3)
-
Chris Evich -
Johannes Kastl -
Mehdi Haghgoo