Check if the specified host path exists and is the expected type

这是我的docker目录挂载命令,其目的是为了达到修改linux上的文件同步到容器上,从而实现修改容器的配置文件。
主要错误: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.

 docker run -di --name=elasticsearch -p9200:9200 -p9300:9300 -v /usr/share/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml de05e10fa879

命令执行后报错:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/usr/share/elasticsearch.yml\\\" to rootfs \\\"/var/lib/docker/devicemapper/mnt/e45ab0cdcfb0a2c48a6c25607489a072a80d786fd9cbad871eb71c09ce523801/rootfs\\\" at \\\"/var/lib/docker/devicemapper/mnt/e45ab0cdcfb0a2c48a6c25607489a072a80d786fd9cbad871eb71c09ce523801/rootfs/usr/share/elasticsearch/config/elasticsearch.yml\\\" 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.

他的意思是说你的/usr/share/elasticsearch.yml是目录,不能挂载,你可以把/usr/share/elasticsearch.yml删除后,创建一个文本文件(touch elasticsearch.yml),再次执行挂载命令即可.

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值