Cannot install docker image from Terminal after fresh reinstall and update

I need a MQTT broker, but cannot install eclipse-mosquitto:latest.
I tried following
docker run -it -d --name mos1 -p 1883:1883 -v /etc/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf eclipse-mosquitto:2

But then I get permission error
I cannot run docker in the terminal without sudo. When running sudo docker info I get all responses. However for the mosquito it runs in permission errors halfway in the process.

Any idea what needs to be done to get it installed?

This is after a clean reinstall of the Zima Board with USB stick and use of Clonezilla. Also full update of Linux and casaos latest version

casaos@CasaOS:~$ docker info
Client: Docker Engine - Community
Version: 27.5.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.20.0
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.32.4
Path: /usr/libexec/docker/cli-plugins/docker-compose
scan: Docker Scan (Docker Inc.)
Version: v0.23.0
Path: /usr/libexec/docker/cli-plugins/docker-scan

Server:
ERROR: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get “http://%2Fvar%2Frun%2Fdocker.sock/v1.47/info”: dial unix /var/run/docker.sock: connect: permission denied
errors pretty printing info

This is the output after my command. I did reboot
docker run -it -d --name mos1 -p 1883:1883 -v /etc/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf eclipse-mosquitto:latest
Unable to find image ‘eclipse-mosquitto:latest’ locally
latest: Pulling from library/eclipse-mosquitto
Digest: sha256:deae95623b9d5c6ca5e264380629db53b992106d436b56d42f7c8df46b41b96f
Status: Downloaded newer image for eclipse-mosquitto:latest
44cf11bdcca99f8077bde307610e7af3d924b9fcfd8898b26939df8864b5ff51
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting “/etc/mosquitto/mosquitto.conf” to rootfs at “/mosquitto/config/mosquitto.conf”: create mountpoint for /mosquitto/config/mosquitto.conf mount: cannot create subdirectories in “/var/lib/docker/overlay2/a333e0dde4877e4cd0043f33739ad1e869adb13a4c61444afec6c0e9244407d1/merged/mosquitto/config/mosquitto.conf”: 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.

IT IS RIDICULOUS. Fresh Reinstall, completed apt update && apt upgrade casaos updated AND I CANNOT INSTALL A DOCKER IMAGE/CONTAINER. THIS SHOULD NOT HAPPEN!!!

Even as a root user logged in as root in the terminal I get the same error!

name: mosquitto
services:
  main_app:
    cpu_shares: 10
    command: []
    container_name: eclipse-mosquitto
    deploy:
      resources:
        limits:
          memory: 7375M
    image: eclipse-mosquitto:latest
    labels:
      icon: https://icon.casaos.io/main/all/eclipse-mosquitto.png
    ports:
      - target: 1883
        published: "1883"
        protocol: ""
      - target: 9001
        published: "9001"
        protocol: ""
    restart: unless-stopped
    volumes:
      - type: bind
        source: /media/ZimaOS-HD/AppData/mosquitto/config
        target: /mosquitto/config
      - type: bind
        source: /media/ZimaOS-HD/AppData/mosquitto/data
        target: /mosquitto/data
      - type: bind
        source: /media/ZimaOS-HD/AppData/mosquitto/log
        target: /mosquitto/log
    devices: []
    cap_add: []
    environment: []
    network_mode: bridge
    privileged: false
x-casaos:
  author: self
  category: self
  hostname: ""
  icon: https://icon.casaos.io/main/all/eclipse-mosquitto.png
  index: ""
  is_uncontrolled: false
  port_map: "1883"
  scheme: http
  store_app_id: mosquitto
  title:
    custom: Mosquitto Broker

Add your mosquitto.conf to the config file and you should be able to start the container.

Thank you for your answer, but I am totally confused about what I have to do with that config file!

I have started a completely new ISO installation and updated Debian and CasaOS to the latest version.
I installed Node-RED and this works on Zima Board.
What shall I do now to install Mosquitto MQTT broker???

Click App Store → Add a containerized application (right top corner) → Import (Next to the X icon). And then import the code from here.

So I followed your advice.
It is called Custom Install and then I have to fill in a form. Not all fields are clear to me. Let’s start:
eclipse-mosquitto:latest
Web UI : x.x.x.x :1883
Network : bridge ???
Port Host 1883:1883 TCP
Do I need a volume outside container? Nothing is filled in! I used /DATA/AppData/node-red/data:/data as volume also without success…
CPU-Shares : Medium
Container name:mqtt

It runs and a pop-up appears with Mosquitto OK.
Should I use username/password from Terminal or will there be no password or do I have to define it myself?
The node in Node-RED does not connect yet in Node-RED

I have expanded the AppStore with a few other community stores - Awesome Store list | Awesome CasaOS - . There I found the MQTT Mosquitto broker with some tricky installation script in it, and the app worked instantly. The only problem now is getting the right timezone into the container. I have to add Env. var TZ :Europe/Amsterdam as node-red Settings!