Sign inSign up

lawtancool/mosquitto-env-auth

By lawtancool

•Updated about 5 years ago

Image
0

533

lawtancool/mosquitto-env-auth repository overview

⁠Running Mosquitto with auth in Docker

Docker Hub

Simple example of how to run Mosquitto with auth in Docker. Based on the official Eclipse Mosquitto MQTT Broker Docker image⁠.

⁠Usage

Place the Mosquitto credentials to the .env file that will be used by the docker-compose⁠.

MOSQUITTO_USERNAME=mosquitto
MOSQUITTO_PASSWORD=mosquitto
⁠Build and run
docker-compose build
docker-compose up -d
⁠Testing

Try the MQTT client⁠ to connect to the Mosquitto MQTT Broker. Use 127.0.0.1:1883 for a local environment.

Or use official mosquitto_pub and mosquitto_sub utilities for publishing and subscribing.

# Subscribe to topic.
mosquitto_sub -h localhost -t test -u "mosquitto" -P "mosquitto"

# Publish a message.
mosquitto_pub -h localhost -t test -m "hello." -u "mosquitto" -P "mosquitto"

Tag summary

Content type

Image

Digest

Size

4.4 MB

Last updated

about 5 years ago

docker pull lawtancool/mosquitto-env-auth