Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

ruimarinho/docker-mosquitto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


⚠️ As of late 2018, the Eclipse Foundation resumed official support for Docker Hub with new eclipse-mosquitto images.


ruimarinho/mosquitto

A mosquitto docker image.

Supported tags and respective Dockerfile links

This image will be automatically updated whenever there is an update to the base image (alpine).

What is mosquitto?

from eclipse/mosquitto:

Mosquitto is an open source implementation of a server for version 3.1 and 3.1.1 of the MQTT protocol. It also includes a C and C++ client library, and the mosquitto_pub and mosquitto_sub utilities for publishing and subscribing.

from mqtt.org:

MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium. It is also ideal for mobile applications because of its small size, low power usage, minimised data packets, and efficient distribution of information to one or many receivers.

Usage

How to use this image

This image contains the server binary from the mosquitto project and client utilities such as mosquitto_pub and mosquitto_sub for publishing and subscribing.

❯ docker run --rm -it ruimarinho/mosquitto

By default, the mosquitto server will run as user mosquitto for security reasons and on the default port 1883.

Using a custom config

The default /etc/mosquitto is read by the mosquitto server so you can map a host volume to customize it:

❯ docker run \
  -p 1883:1883 \
  -p 9001:9001 \
  -v /volume1/applications/mosquitto:/etc/mosquitto \
  -d \
  mosquitto -c /etc/mosquitto/mosquitto.conf -v

Running mosquitto client utilities

Run a test server:

❯ docker run --rm -it \
  --name mosquitto-server \
  ruimarinho/mosquitto

mosquitto_sub

mosquitto_sub is an mqtt client that subscribes to a single topic and prints all the messages it receives.

❯ docker run --rm -it \
  --link mosquitto-server \
  ruimarinho/mosquitto mosquitto_sub -h mosquitto-server -t '#'

mosquitto_pub

mosquitto_pub is an mqtt client that publishes a message on a single topic and exits.

❯ docker run --rm -it \
  --link mosquitto-server \
  ruimarinho/mosquitto mosquitto_pub -h mosquitto-server -t home-assistant/switch/1/on -m "Switch is ON"

Supported Docker versions

This image is officially supported on Docker version 1.12, with support for older versions provided on a best-effort basis.

License

License information for the software contained in this image.

License information for the ruimarinho/docker-mosquitto docker project.