Run docker container in Azure with config in Azure file share (mosquitto broker)

Viewed 435

I would like to run a mosquitto MQTT-broker in Azure as a docker container. (I know azure has an iot-hub... but i would like to have a self-managed broker). I would like to have the mosquitto.conf file in an Azure file share to get a persistent own config and not the default one. I deployed the docker image as following:

az container create \
    --resource-group XXX \
    --name mosquitto \
    --image eclipse-mosquitto \
    --dns-name-label XXX-mqtt \
    --ports 1883 8883\
    --azure-file-volume-account-name XXX \
    --azure-file-volume-account-key XXX \
    --azure-file-volume-share-name XXX \
    --azure-file-volume-mount-path /fileshare/

The docker image ist created and working fine, also the fileshare mount is accessible if i connect into the container.

My question is: How can i define the docker image to use the mosquitto.conf file in the fileshare and not the default one in the docker image?

The mosquitto docker documentation says:

When running the image, the default configuration values are used. To use a custom configuration file, mount a local configuration file to /mosquitto/config/mosquitto.conf

$ docker run -it -p 1883:1883 -p 9001:9001 -v mosquitto.conf:/mosquitto/config/mosquitto.conf eclipse-mosquitto

How can i pass the -v mosquitto.conf:/mosquitto/config/mosquitto.conf argument to the image? With an environment variable?

Thanks for help!

0 Answers
Related