Docker-compose 启动 mysql 报错 ERROR: for mysql Cannot start service mysql: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start
报错详情
root@hadoop107 cmp]# docker-compose config -q [root@hadoop107 cmp]# ll 总用量 70192 -rw-r--r--. 1 root root 71865074 9月 24 06:45 docker-boot-0.0.1-SNAPSHOT.jar -rw-r--r--. 1 root root 1014 9月 24 08:26 docker-compose.yml -rw-r--r--. 1 root root 497 9月 24 06:13 Dockerfile [root@hadoop107 cmp]# [root@hadoop107 cmp]# [root@hadoop107 cmp]# docker-compose up -d Creating cmp_mysql_1 ... error Creating cmp_redis_1 ... ERROR: for cmp_mysql_1 Cannot start service mysql: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: u nable to start container process: error during container init: error mounting "/wdh01/mysql/conf/my.cnf" to rootfs at "/etc/my.cnf": mount /wdh01/mysql/conf/my.cnf:/ etc/my.cnf (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified ho Creating cmp_redis_1 ... done ERROR: for mysql Cannot start service mysql: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/wdh01/mysql/conf/my.cnf" to rootfs at "/etc/my.cnf": mount /wdh01/mysql/conf/my.cnf:/etc/my .cnf (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host pat h exists and is the expected type ERROR: Encountered errors while bringing up the project.
原因分析
这里的原因是因为创建的 my.cnf 的时候应该是个文件,而这里却是目录,去改一下即可,前往以下目录
[root@hadoop107 mysql]# cd conf/ [root@hadoop107 conf]# ll 总用量 4 drwxr-xr-x. 2 root root 4096 9月 24 08:26 my.cnf [root@hadoop107 conf]# cat my.cnf/ cat: my.cnf/: 是一个目录 [root@hadoop107 conf]# rm -rf my.cnf/ [root@hadoop107 conf]# touch my.cnf [root@hadoop107 conf]# ll 总用量 0 -rw-r--r--. 1 root root 0 9月 24 20:32 my.cnf
再次执行正常了
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 一文读懂知识蒸馏
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下