Docker安装MySQL5.7
docker pull mysql:5.7
docker run
docker run -d -p 9020:3306 --privileged=true -v /home/mysql/conf/my.cnf:/etc/my.cnf -v /home/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --name mysql mysql:5.7 --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
note:
报错:
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/mysql/conf" to rootfs at "/etc/my.cnf": mount /home/mysql/conf:/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.
处理:
cd到 /home/mysql/conf
vi 一个 my.cnf
然后chmod 775 my.cnf
然后 docker rm后,再run,就行了
联系客服