Mariadb-docker: Ctrl+C does not kill mysqld

Created on 15 Sep 2016  路  3Comments  路  Source: MariaDB/mariadb-docker

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.

Most helpful comment

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.

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

foxx picture foxx  路  4Comments

amq picture amq  路  4Comments

J0WI picture J0WI  路  5Comments

iBobik picture iBobik  路  7Comments

shawnweeks picture shawnweeks  路  4Comments