title: MQTT with NGINX and Let's Encrypt
body: <p>I want to set up an MQTT (broker) server with NGINX and Let's Encrypt.</p>
  <p>For information, I use this repository for NGINX and Let's Encrypt:
  <a href="https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion" rel="nofollow noreferrer">https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion</a></p>
  <p>Here is the diagram :</p>
  <p><a href="https://i.stack.imgur.com/Akb2z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Akb2z.png" alt="enter image description here" /></a></p>
  <p>I already have several sites in place. (wordpress, portainer, ...)</p>
  <p>This is my docker-compose.yml :</p>
  <pre><code>version: '3'
  services:
    mosquitto:
      container_name: ${CONTAINER_MQTT_WEB}
      image: eclipse-mosquitto:latest
      restart: always
      ports:
         - &quot;1883:1883&quot;
         - &quot;9001:9001&quot;
      volumes:
        - ./data-mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf
        - ./data-mosquitto/data:/mosquitto/data
        - ./data-mosquitto/log:/mosquitto/log
      environment:
        - DOMAIN= ${DOMAINS}
        - VIRTUAL_HOST= ${DOMAINS}
        - LETSENCRYPT_HOST= ${DOMAINS}
        - LETSENCRYPT_EMAIL= ${LETSENCRYPT_EMAIL}
  
  networks:
      default:
         external:
           name: ${NETWORK}
  </code></pre>
  <p>This is my environement file (.env) :</p>
  <pre><code># Creation TOF
  # Contact : My  EMAIL
  #
  # Containers name
  CONTAINER_MQTT_WEB=MQTT_web-ssl
  
  # Host
  DOMAINS=mqtt.mywebsite.com
  LETSENCRYPT_EMAIL=email@mywebsite.com
  #
  # Network name
  #
  # Your container app must use a network conencted to your webproxy
  # https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
  #
  NETWORK=webproxy
  </code></pre>
  <p>I've an error, but i don't understand...</p>
  <pre><code>Creating MQTT_web-ssl ... error
  
  ERROR: for MQTT_web-ssl  Cannot start service mosquitto: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting &quot;/home/theking/Docker/docker-mosquitto-nginx-letsencrypt/data-mosquitto/config/mosquitto.conf&quot; to rootfs at &quot;/home/.../dockerdrive/overlay/ee4ef10d2f021c03b1556d9547f8c877d83c9128cad37c2a2a4ba1ff2c367d40/merged/mosquitto/config/mosquitto.conf&quot; 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
  </code></pre>
  <p>Thank you for your help :)</p>
  <p>Have nice day</p>
  <p>Christophe</p>