First, install the Docker Desktop application for MacOS X. Go to https://hub.docker.com/ and create an account, then install the client application.
Then, run this command in Terminal:
- Code: Select all
docker run --detach --publish 1883:1883 --name=mosquitto eclipse-mosquitto
This will download the eclipse-mosquitto container and run it in the background. It will map (publish) port 1883 on the local machine to port 1883 inside the Docker container.
That's it. You can now configure an MQTT Broker device for port 1883 at the local machine's IP address or the 127.0.0.1 loopback address.
Go to https://docs.docker.com/docker-for-mac/ for detailed docs on using Docker.