chriszarate / docker-compose-wordpress

An example Docker Compose setup for WordPress plugin or theme development.
162 stars 54 forks source link

Can't wp db export: Permission Denied #21

Closed MikeiLL closed 3 years ago

MikeiLL commented 3 years ago

Not sure if you're still maintaining the (awesome) repo.

This seems like a limitation:

docker-compose run --rm wp-cli wp db export
Creating my_project_wp-cli_run ... done
mysqldump: Can't create/write to file 'wordpress-2021-09-08-1296a45.sql' (Errcode: 13 "Permission denied")

Tried running with sudo. No success.

chriszarate commented 3 years ago

The current directory gets mapped read-only into the container:

https://github.com/chriszarate/docker-compose-wordpress/blob/master/docker-compose.yml#L19

Without making any changes, you can target stdout by passing - as the file path (see WP-CLI docs) and then redirect the output locally to a file:

docker-compose run --rm wp-cli wp db export - > dump.sql

Alternatively, remove the :ro flag from the volume mount. Or map a different volume and point the dump there.

MikeiLL commented 3 years ago

Thanks much, Chris.