f:: Docker

Eclipse Mosquitto MQTT

mkdir -p docker/mosquitto
cd docker/mosquitto
mkdir -p config data log
 
cd config
cat << EOF > mosquitto.conf
allow_anonymous true
 
listener 1883
protocol mqtt
 
listener 9001
protocol websockets
 
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
EOF
 
cd ../..
docker run -it \
    --name mosquitto \
    -p 1883:1883 \
    -p 9001:9001 \
    -v $PWD/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf \
    -v /mosquitto/data \
    -v /mosquitto/log \
    eclipse-mosquitto:2.0.11