在Docker容器中正确closuresMySQL 4

对于一些(非常)遗留应用程序,我需要一个MySQL 4安装。 基于

  • https://github.com/Tommi2Day/mysql4
  • https://github.com/stevemayne/mysql4docker

我已经创build了一个docker容器,一般工作正常。 粗略地说,他们做了以下的事情

  • 从源代码编译MySQL 4.1.25
  • 添加一个大致如下所示的入口点

    if [ "$1" = 'mysqld_safe' ]; then # do some things to initialize database if required fi exec "$@" 
  • 这被称为使用

     ENTRYPOINT ["/path/to/entrypoint.sh"] CMD ["mysqld_safe"] 

但是,我有以下问题:当停止泊坞窗容器,似乎mysqld_safe未正确closures。 当我重新启动容器时,我收到以下错误日志

 170419 11:23:44 mysqld started 170419 11:23:44 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... 170419 11:23:44 InnoDB: Starting log scan based on checkpoint at InnoDB: log sequence number 0 43684. InnoDB: Doing recovery: scanned up to log sequence number 0 43684 InnoDB: Last MySQL binlog file position 0 79, file name ./09601db873a9-bin.000003 170419 11:23:44 InnoDB: Flushing modified pages from the buffer pool... 170419 11:23:44 InnoDB: Started; log sequence number 0 43684 /usr/local/mysql/libexec/mysqld: ready for connections. Verion: '4.1.25-log' ssocket: '/tmp/mysql.sock' port: 3306 Source distribution 

这似乎发生,因为mysqld_safe基本上忽略任何信号( /usr/local/myslq/bin/mysqld_safe第16行):

 trap '' 1 2 3 15 # we shouldn't let anyone kill us 

这让我想,也许mysqld_safe不是在容器中启动MySQL的正确方法? 在Docker容器中启动和停止MySQL 4的推荐方法是什么? (不幸的是,容器将不得不偶尔停止。)