docker启动mysql5.7

image-20230412110720083

遇到这样的问题,再 github 上也碰到过:

https://github.com/docker-library/mysql/issues/579

image-20230413100942110

解释原因是因为限制 nofile 的原因

解决办法,再 docker-compose 中添加如下

1
2
3
4
5
ulimits:
  nproc: 65535
  nofile:
    soft: 26677
    hard: 46677

即可。

或者再 docker 配置文件/etc/docker/daemon.json 上添加:

1
2
3
4
5
6
7
8
9
{
        "default-ulimits": {
                "nofile": {
                        "Hard": 64000,
                        "Name": "nofile",
                        "Soft": 64000
                }
        }
}

参考文档:

https://github.com/docker-library/mysql/issues/579

https://tianheg.xyz/posts/docker-mysql-too-much-memory-archlinux/

Licensed under CC BY-NC-SA 4.0
最后更新于 Jan 06, 2025 05:52 UTC
comments powered by Disqus
Built with Hugo
主题 StackJimmy 设计
Caret Up