今天docker启动时遇到无法启动的情况,苦苦搜索了半天(这里吐槽一下某度真的垃圾),最后通过谷歌找到一个日文链接,得到了解决办法,这里记录一下
host@DESKTOP-H1UNVPM:~/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