[英]Docker container not starting with ubuntu image (docker start)
[英]docker container wont start with Mysql docker image
我使用帶有mysql官方圖像的docker容器來創建超過11個數據庫容器(container1到container11)。 設置完成后,所有容器都運行正常,直到container9。 在container10,它只啟動約1分鍾並再次停止。 使用docker日志來檢查容器,但我沒有看到任何東西。 停止container9,並重啟container10。 它再次運行良好。 這種情況似乎只發生在我有9個mysql容器並試圖提高第10個時。 如果我停止其中一個,然后重新抬起它。 那就沒問題了。 它是錯誤的嗎? 或者我想念碼頭橋的一些設置?
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#
我想我在一周之后就遇到了解決方案,盡管我不太明白會發生什么。 以下是我嘗試過的,到目前為止,我可以調出最多20個mysql容器,沒有任何問題。
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
並使用EAGAIN命中io_setup()的錯誤代碼失敗
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 events
,然后嘗試啟動第10個容器。 你肯定會看到出了什么問題。 下面給出了一個示例,用於在啟動時啟動已退出的容器和錯誤。 以下命令依次:
~$ sudo docker events &
[1] 9414
~$ sudo docker start 48137950f1b7
2017-08-03T00:01:18.971406558+05:30 network connect c79096ff0fef046d24b2a23907b3cc82c4df0838db2475909f8fa9f796a0418e (container=48137950f1b714797143529d63ec7221d3cbcd38bb6c8d20a241b06ddbd3d27a, name=bridge, type=bridge)
2017-08-03T00:01:19.305063392+05:30 container start 48137950f1b714797143529d63ec7221d3cbcd38bb6c8d20a241b06ddbd3d27a (image=ubuntu, name=modest_northcutt)
48137950f1b7
2017-08-03T00:01:19.305915636+05:30 container die 48137950f1b714797143529d63ec7221d3cbcd38bb6c8d20a241b06ddbd3d27a (exitCode=0, image=ubuntu, name=modest_northcutt)
希望你能搞清楚。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.