命令如下:
docker run -d -p 3306:3306 --name mysql01 -v=/docker/mysql/config/my.cnf:/etc/my.cnf -v=/docker/mysql/data:/var/lib/mysql mysql/mysql-server
已经在Host主机上创建对应的文件夹及文件目录,运行时出现以下错误:
Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\"/docker/mysql/config/my.cnf\\\" to rootfs \\\"/var/lib/docker/overlay2/1bde9f49f803dd3a24ba95e2d9355f6d14491d8a9db315f42c3f98711d866323/merged\\\" at \\\"/var/lib/docker/overlay2/1bde9f49f803dd3a24ba95e2d9355f6d14491d8a9db315f42c3f98711d866323/merged/etc/my.cnf\\\" caused \\\"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.
有没有遇到同样问题的同学们。