If I startup MySQL server during docker build
(derived from official MySQL Dokcer Image) in two different statements, would be database files be pertained?
I would say yes, but it seems to be wrong. Why?
Logfile:
180228 08:54:50 mysqld_safe Logging to '/var/lib/mysql/c2712433a4da.err'.
180228 08:54:50 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
Tables_in_FOOBAR
address
category
Removing intermediate container b3ff83bbf273
---> 0b366a0d31a9
Step 9/9 : RUN chmod 777 /var/lib/ -R && ./ingest_data.sh
---> Running in 149361f7d465
180228 08:55:00 mysqld_safe Logging to '/var/lib/mysql/c2712433a4da.err'.
180228 08:55:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql: [Warning] Using a password on the command line interface can be insecure.
Database
information_schema
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1049 (42000): Unknown database 'FOOBAR'
As you can see, in the first RUN statement I can list tables I have created in a new database, but in the second RUN statement the database is gone.
Note. Normally, you would not transport your application data in production containers (immutability principle) but for demo and test purposes this can be nevertheless useful.