gpt4 book ai didi

docker 容器不会以 Mysql docker 镜像启动

转载 作者:行者123 更新时间:2023-12-03 21:28:57 25 4
gpt4 key购买 nike

我使用带有 mysql 官方镜像的 docker 容器创建了 11 个以上的数据库容器(container1 到 container11)。设置后,所有容器运行良好,直到 container9。在 container10 上,它仅启动约 1 分钟并再次停止。使用 docker logs 检查容器,但我什么也没看到。停止container9,重启container10。它再次运行良好。这种情况似乎只发生在我有 9 个 mysql 容器并试图提高第 10 个时。如果我阻止其中一个,然后再次举起它。然后就没有问题了。是bug吗?或者我错过了 docker bridge 的一些设置?

root@ec8dcb82f64d:/dev/shm# docker restart f4801b57c4cc
f4801b57c4cc
root@ec8dcb82f64d:/dev/shm# docker ps -a | grep f4801b57c4cc
f4801b57c4cc mysql/mysql-server:5.7 "/entrypoint.sh my..." 2 weeks ago Exited (1) 3 seconds ago db
root@ec8dcb82f64d:/dev/shm# docker logs f4801b57c4cc
Initializing database
Database initialized
MySQL init process in progress...
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.

/entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*


MySQL init process done. Ready for start up.

root@ec8dcb82f64d:/dev/shm#

最佳答案

我想我在一周后找到了解决方案,即使我真的不明白会发生什么。以下是我尝试过的,到目前为止,我可以毫无问题地将 mysql 容器调至 20 个。

1:尝试创建一个dummpy mysql容器进行测试

$ docker run -e MYSQL_ROOT_PASSWORD=password mysql
Unable to find image 'mysql:latest' locally
latest: Pulling from library/mysql
...
Initializing database
2017-08-09T17:58:30.034595Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-08-09T17:58:30.039274Z 0 [Warning] InnoDB: io_setup() failed with EAGAIN. Will make 5 attempts before giving up.
2017-08-09T17:58:30.039294Z 0 [Warning] InnoDB: io_setup() attempt 1.
2017-08-09T17:58:30.539495Z 0 [Warning] InnoDB: io_setup() attempt 2.
2017-08-09T17:58:31.039701Z 0 [Warning] InnoDB: io_setup() attempt 3.
2017-08-09T17:58:31.539902Z 0 [Warning] InnoDB: io_setup() attempt 4.
2017-08-09T17:58:32.040115Z 0 [Warning] InnoDB: io_setup() attempt 5.
2017-08-09T17:58:32.540330Z 0 [ERROR] InnoDB: io_setup() failed with EAGAIN after 5 attempts.
2017-08-09T17:58:32.540378Z 0 [ERROR] InnoDB: Cannot initialize AIO sub-system
2017-08-09T17:58:32.540390Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-08-09T17:58:32.540401Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-08-09T17:58:32.540408Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-08-09T17:58:32.540412Z 0 [ERROR] Failed to initialize plugins.
2017-08-09T17:58:32.540415Z 0 [ERROR] Aborting

并点击 的错误代码io_setup() 失败,EAGAIN

2:检查aio-max-nr的当前值
$ sysctl fs.aio-max-nr
fs.aio-max-nr = 65536

3:将aio-max-nr的值增加到2097152
$ sudo sysctl -w fs.aio-max-nr=2097152

3:启动mysql服务

4: 尝试创建更多的 mysql 容器,并没有问题地调出原来的容器

关于docker 容器不会以 Mysql docker 镜像启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45467988/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com