天天看点

docker-compose启动报错Error response from daemon: xxx is mounted on / but it is not a shared mount.

今天docker启动时遇到无法启动的情况,苦苦搜索了半天(这里吐槽一下某度真的垃圾),最后通过谷歌找到一个日文链接,得到了解决办法,这里记录一下

[email protected]:~/workspace/heating/compose$ docker-compose up -d
	[+] Running 6/7
	 ⠿ Network heating_dev_default          Created                                                                                                                                                             0.7s
	 ⠿ Container heating_dev_redis_1        Created                                                                                                                                                             0.1s
	 ⠿ Container heating_dev_loki_1         Created                                                                                                                                                             0.1s
	 ⠿ Container heating_dev_nginx_1        Created                                                                                                                                                             0.1s
	 ⠋ Container heating_dev_mqtt-broker_1  Creating                                                                                                                                                            0.1s
	 ⠿ Container heating_dev_prometheus_1   Created                                                                                                                                                             0.1s
	 ⠿ Container heating_dev_mysql_1        Created                                                                                                                                                             0.1s
	Error response from daemon: path /home/wjl/workspace/heating/compose/mosquitto/config is mounted on / but it is not a shared mount.
           

docker-compose.yml里的写法如下

volumes:
      - ./mosquitto/config:/mosquitto/config/:ro
           

问题出在config后面的

/

解决办法,删掉最后的那个

/

volumes:
      # - ./mosquitto/config:/mosquitto/config/:ro
      - ./mosquitto/config:/mosquitto/config:ro