docker启动失败:failed to create task for container:... not a directory: unknown: Are you trying to mount
docker启动失败: failed to create task for container: ...not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)
使用docker创建mysql容器出错:
Error response from daemon: 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 "/data/mysql/my.cnf" to rootfs at "/etc/my.cnf": mount /data/mysql/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 path exists and is the expected type
解决方法:
原因是因为挂载数据文件时/data/mysql/my.cnf是以一个目录生成,而不是文件!!!(由于容器内的/etc/my.cnf是文件,而挂载时/data/mysql/my.cnf是目录)
所以:删除my.cnf 目录,然后新建一个my.cnf 文件就可以了。
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)