not shared from the host and is not known to Docker
原创
©著作权归作者所有:来自51CTO博客作者szlsay的原创作品,请联系作者获取转载授权,否则将追究法律责任
问题内容
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 -v ${ES_SINGLE}/config/es-single.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v ${ES_SINGLE}/data:/usr/share/elasticsearch/data --name st_es elasticsearch:7.14.2
ab5c7ba2e09062d54f22b7de6e0c444acfa3e5413ed5abe911eb2b96d61d0358
docker: Error response from daemon: Mounts denied:
The path /opt/workspace/work/es/single/config/es-single.yml is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/desktop/mac for more
问题解决:
在Docker中添加文件共享,具体操作如下图所示