This is a sample logging app using MQTT ready for Docker.
The following steps assume that you have Docker already installed on your machine (https://docs.docker.com/linux/):
- open a terminal window and navigate to where your cloned this repository
- build the image:
docker build -t <your username>/docker-log .
- verify you have a new image:
docker images
- run the image:
docker run -P --name docker-log --link docker-mosquitto:docker-mosquitto <your username>/docker-log
- open another terminal window
mosquitto_pub -h localhost -p 1883 -t dc/send-log -m 'Test 123'
- verify the log was processed in the terminal window
If you want to kill the Docker process execute the following command in a terminal window:
docker ps -a | grep docker-log
You will be presented with any matching information. You can get the find the unique id of the prcess and execute the following command to stop it:
docker stop <pid>
You will also need to remove the named alias:
docker rm docker-log
mosquitto_pub -t dc/send-log -m 'Testing 123'
/usr/local/sbin/mosquitto -c /usr/local//etc/mosquitto/mosquitto.conf