10up / wp-local-docker

****** WP Local Docker V2 is now available - https://github.com/10up/wp-local-docker-v2
MIT License
749 stars 152 forks source link

update docker-compose mysql service #131

Closed loru88 closed 5 years ago

loru88 commented 6 years ago

I found problems with Docker Machine users on Windows 10 to have the following error at container creation time

[ERROR] InnoDB: Operating system error number 22 in a file operation.
[ERROR] InnoDB: Error number 22 means 'Invalid argument'
[ERROR] InnoDB: File ./ib_logfile101: 'aio write' returned OS error 122. Cannot continue operation

To solve that, I mount the db data to a named volume, in this way a docker-compose down won't destroy data, unless you use the -v option https://docs.docker.com/compose/reference/down/

I even mount the "data/db" folder to the internal mysql docker container folder "/docker-entrypoint-initdb.d" to enable auto import if there is any SQL file (like a backup). read more at https://hub.docker.com/_/mysql/ at "Initializing a fresh instance" paragraph

The database files are not anymore visible under "data/db" because the named volume is only internally monuted inside the mysql container. Obviously the database can still be access via WP CLI or PhpMyAdmin.

cmmarslender commented 5 years ago

V2 (currently beta) of WP Local Docker uses a volume for the DB: https://github.com/10up/wp-local-docker-v2