4 ms·
I've had the same issue with MySQL. It's an issue of timing - You install MySQL, and the MySQL data directory has its data/default databases. Then you share the
by fideloper 13y ago
I've had the same issue with MySQL. It's an issue of timing - You install MySQL, and the MySQL data directory has its data/default databases. Then you share the directory with Docker, and the data lib directory is wiped out (the files don't exist on the host machine, after all). Getting it right in an automated way is a Hard Problem™.
As of now, I'm keeping data persisted within the Container, which I don't necessarily like. I would love to hear a good solution on that.
- izietto 13y agoSince I already use schroot and I'm happy with it since it is a mature project I'll continue to use it, keeping a look to next Docker developments.
- kl4m 13y agoAs a note, for Debian/Ubuntu, you can recreate the default DBs on a shell with mysql_install_db followed by mysql_secure_installation .
- tonyhb 13y agoHere's a dockerfile setup I wrote for Postgres which uses a 'data container' for the entire Postgres database: https://github.com/codelittinc/dockerfiles/tree/master/postgres https://github.com/codelittinc/dockerfiles/tree/master/postg... The gist of it is that you explicitly tell your DB container that there will be a shared directory on the container at runtime. This allows you to chown the directory before the data container is added. Then, when you're running, use --volumes-from `$data-container-name` and it'll work. Want an article on it?
- fideloper 13y agoAwesome, thanks. I can figure it out from that example most likely, but an article would never hurt :D
- kevinschumacher 13y agoAn article on that would be great!
- cpuguy83 13y agoThat's actually not true at this time. When you turn a directory into a volume, Docker will copy whatever the contents of that directory into the volume directory... But you need to make the volume after the directory is populated.