The docker container does not stop on CTRL+C like any other programm would do.
After starting a non-detached (i.e. missing -d parameter) maridb docker instance via:
$ docker run --name some-mariadb -e MYSQL_ROOT_PASSWORD=my-secret-pw mariadb
I'm unable to issue CTRL+C - its just ignored. It only reacts on docker stop some-mariadb
In combination with docker-compose this is really an issue: It seems when issuing docker-compose stop, just a CTRL+C signal is sent to the docker container until the timeout of docker-compose is reached (10s per default). However, the docker container seems to do no "Normal shutdown".
On docker-compose timeout, the docker container instance is just killed. As a result the mysql table is always corrupt and needs to be repaired on next boot.
This is the same as https://github.com/docker-library/mysql/issues/47 and https://github.com/docker-library/mysql/pull/117.
This is not a bug, mysqld does not reply to Ctrl-C signals as you would expect to. It needs to be shutdown either by SIGTERM or administrative command.
It also works fine with compose in my experience. If your container takes more than 10s to stop, it's because InnoDB might still be flushing pages if you have many dirty pages in memory, and it needs more time to stop. You can specify a higher timeout if need to, so compose won't just kill your container.
If you are running in non-detached mode, you may send a SIGQUIT signal to the process. This is typically mapped to your Control-\ key combination.
Most helpful comment
If you are running in non-detached mode, you may send a
SIGQUITsignal to the process. This is typically mapped to yourControl-\key combination.