docker run -d --name myphp7 --restart=always -p 9002:9002 \
-v /usr/local/docker/php/etc/apt/sources.list:/etc/apt/sources.list \
-v /usr/local/docker/nginx/html:/var/www/html \
-v /usr/local/docker/php/php-fpm.d/my.conf:/usr/local/etc/php-fpm.d/my.conf \
-v /etc/localtime:/etc/localtime \
php:7.3.11-fpm
今天在mac上用docker挂载时,一直报错:
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 "/usr/local/docker/php/etc/apt/sources.list" to rootfs at "/etc/apt/sources.list": mount /usr/local/docker/php/etc/apt/sources.list:/etc/apt/sources.list (via /proc/self/fd/14), 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.
解决:
把你要挂载的父级目录对应放到 File Sharing 底下,重启后,再次挂载,就正常了(mac下有这个问题,linux下正常)