Error with Mosquitto Container - ERRO[0004] error waiting for container: context canceled

For the following error after a docker run command:


docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: rootfs_linux.go:60: mounting “/mosquitto/mosquitto.conf” to rootfs at “/home/docker/overlay2/06e7e424e57112de7ce97a0e91098c67332fce8e2909c7ab080da934ed605d5c/merged/mosquitto/config/mosquitto.conf” 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.

ERRO[0004] error waiting for container: context canceled


This error indicates that the mosquitto.conf file is missing. In this case you will need to delete the /mosquitto directory and start anew:

  1. rm -r /mosquitto
  2. mkdir /mosquitto
  3. cd /mosquitto
  4. wget https://raw.githubusercontent.com/jessejamescox/wago-mosquitto-config/main/mosquitto.conf
  5. docker run -it -p 1883:1883 -v /mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf --restart unless-stopped eclipse-mosquitto:2.0.11