Hi all.
I created 2 containers, one with a mariadb database server running, and another with Piwik Analytics installed. I start the mariadb container first and link to it from the Piwik Analytics container. So far so good. When I try to commit the mariadb container to a new image, the updates made to the mariadb container with the piwik database are NOT commited to the new image. So my question is how do I make a database persist when commiting a container with a new database to another new image, so I can run new containers using that database?
where the command to start the piwik-database is:
docker run -itd --name piwik-database --hostname piwik-database keithroberts/alpine-mariadb2
to run the container and link to the running piwik-database container:
$ docker run -itd --name ubuntu-piwik-v2 --hostname ubuntu-piwik-v2 --link piwik-database keithroberts/ubuntu-piwik-v2
vagrant@vagrant-ubuntu-trusty-64:~$ docker exec -it piwik-database sh
/ #
/ # mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.1.14-MariaDB MariaDB Server
Copyright © 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> show databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| mysql |
| performance_schema |
| piwik_database |
| test |
±-------------------+
5 rows in set (0.00 sec)
When I commit this to a new image and then run another container from that new image, I loose the piwik_database:
vagrant@vagrant-ubuntu-trusty-64:~$ docker exec -it piwik-database-works sh
/ #
/ # mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.1.14-MariaDB MariaDB Server
Copyright © 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> show databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
±-------------------+
4 rows in set (0.00 sec)
MariaDB [(none)]>
So how do I keep the new piwik_database so I can reuse it again in other containers or images please?
TIA
Keith