Raspberry Pi 3 Python 2.7 IoT API to read temperature & humidity from the DHT11 sensor
545
See Dockerfile on github : https://github.com/allthingsclowd/docker_rpi3_python_iot_api_dht_11_22
The Dockerfile in this repo can be used to build an IoT demo container that runs a Python 2.7 application that will work with the GPIO pins configured to match the following setup :

The docker image can be found here: https://hub.docker.com/r/allthingscloud/rpi3-python-iot-api-dht/
To build the dockerfile on a raspberry pi 3 after cloning this repository:
docker image build --tag allthingscloud/rpi3-python-iot-api-dht -f Dockerfile .
Launch as follows:
docker container run -d -p 4321:8989 --name my-python-iot-demo --device /dev/gpiomem allthingscloud/rpi3-python-iot-api-dht
curl http://raspberry-pi-ip-address:4321/ <-- Returns both the temperature and the humidity readings in JSON format
curl http://raspberry-pi-ip-address:4321/temperature <-- Returns a JSON temperature response
curl http://raspberry-pi-ip-address:4321/humidity <-- Returns a JSON humidity response
Navigate to :
http://raspberry-pi-ip-address:4321/ <-- Returns both the temperature and the humidity readings in JSON format
http://raspberry-pi-ip-address:4321/17/on <-- Returns a JSON temperature response
http://raspberry-pi-ip-address:4321/17/off <-- Returns a JSON humidity response
Please check the official documentation at https://docs.docker.com
I used the following steps :
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
echo "deb [arch=armhf] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install docker-ce
Content type
Image
Digest
Size
322.3 MB
Last updated
over 8 years ago
docker pull allthingscloud/rpi3-python-iot-api-dht