MariaDB / mariadb-docker

Docker Official Image packaging for MariaDB
https://mariadb.org
GNU General Public License v2.0
759 stars 438 forks source link

Ctrl+C does not stop interactive docker container #451

Closed mvorisek closed 2 years ago

mvorisek commented 2 years ago

When I start MariaDB docker image like:

docker run -it --network=host -e MYSQL_ROOT_PASSWORD=rrr -e MYSQL_USER=uuu -e MYSQL_PASSWORD=ppp -e MYSQL_DATABASE=ddd mariadb

Ctrl+c is ignored and the command cannot be interrupted/ended from the current console.

Interactive mode is very handy for development when the database needs to be started for limited time.

Ctrl+c signal is supported by any other major DB docker images like:

docker run -it --network=host -ePOSTGRES_USER=uuu -ePOSTGRES_PASSWORD=ppp -ePOSTGRES_DB=ddd postgres:12-alpine
docker run -it --network=host -eACCEPT_EULA=Y -eSA_PASSWORD=ppp@Str mcr.microsoft.com/mssql/server
dr-m commented 2 years ago

I do not know Docker, but I think that the mariadbd option --debug-gdb should allow SIGINT to shut down the server. By default, SIGQUIT (ctrl-backslash) should initiate a shutdown.

mvorisek commented 2 years ago

I do not know Docker, but I think that the mariadbd option --debug-gdb should allow SIGINT to shut down the server.

--debug-gdb is a solution for me, thank you!

docs: https://mariadb.com/docs/reference/mdb/cli/mariadbd/debug-gdb/

By default, SIGQUIT (ctrl-backslash) should initiate a shutdown.

this works too!

grooverdan commented 2 years ago

I'm assuming the ignoring of SIGINT was a result of closing terminals delivering SIGINT to starting init scripts which didn't always immediately background mysqld (and there are still mysqld_safe paths that don't). Its hard to know who still expects this 20+ year old behaviour to exist (evidently not an insignificant number of container users).

Thanks for SIGQUIT, I didn't know that one existed either.