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 924 06:45 docker-boot-0.0.1-SNAPSHOT.jar
-rw-r--r--. 1 root root     1014 924 08:26 docker-compose.yml
-rw-r--r--. 1 root root      497 924 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 924 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 924 20:32 my.cnf
复制代码

再次执行正常了

 

posted @   晓枫的春天  阅读(229)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 一文读懂知识蒸馏
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
点击右上角即可分享
微信分享提示