Moving mariadb to docker installation

I'm running debian jessie and I'm currently trying to replace all my server services with docker containers. After some research, i tried this command:

docker run --name mariadb -v /var/lib/mysql:/var/lib/mysql -d -p 3306:3306 -d mariadb:latest

after stopping the local mariadb service, but this command didn't work. My webapplications didn't have any database access after. How do i currently move all databases? Is there a more secure way?

I just want a drop-in replacement. Starting the docker container and using the mariadb server as I used to.

Answer

Hi,
you can not just start a new instance of mariadb server in a docker container and expect it to work with you "old" mariadb data.

I think this should be done:

  1. backup local database (logical backup, see url below).
  2. start docker with a new volume for the new database
  3. import the SQL dump into the docker database.

Documentation on how to backup your DB:
https://mariadb.com/kb/en/library/backup-and-restore-overview/

Regards,
Faustin

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.