Docker image with motion-mmal setup and configured to support motion with the raspberry pi camera module based on this post.
In other words, use your raspberry pi with camera module as a surveillance system by running this container.
$ docker run --device /dev/vchiq -p 80:8081 -p 8080:8080 -v /home/pi:/home/pi jritsema/rpi-motion-mmal
or using docker-compose...
motion:
container_name: driveway-motion
image: jritsema/rpi-motion-mmal
devices:
- "/dev/vchiq"
volumes:
- /home/pi/motion:/home/pi
- /home/pi/cam-driveway/motion-mmalcam.conf:/etc/motion.conf
ports:
- "80:8081"
- "8080:8080"
restart: always
Optionally, if you would like each motion event to be auto-tagged using Amazon's Rekognition service, you can add your AWS keys as environment variables and configure motion as follows.
motion:
container_name: driveway-motion
image: jritsema/rpi-motion-mmal
environment:
- "AWS_ACCESS_KEY_ID=xyz"
- "AWS_SECRET_ACCESS_KEY=xyz"
devices:
- "/dev/vchiq"
volumes:
- /home/pi/motion:/home/pi
- /home/pi/cam-driveway/motion-mmalcam.conf:/etc/motion.conf
ports:
- "80:8081"
- "8080:8080"
restart: always
motion.conf
on_picture_save rekognize %f > %f.json
And if you want to auto-email an event based on certain tags, you can use the following.
motion:
container_name: driveway-motion
image: jritsema/rpi-motion-mmal
environment:
- "AWS_ACCESS_KEY_ID=xyz"
- "AWS_SECRET_ACCESS_KEY=xyz"
- "REKOGNOTIFY_MATCH=Human,People,Person,Animal,Mammal"
- "REKOGNOTIFY_HOST=smtp.server.net"
- "[email protected]"
- "REKOGNOTIFY_PASS=xyz"
- "[email protected]>"
- "[email protected]"
devices:
- "/dev/vchiq"
volumes:
- /home/pi/motion:/home/pi
- /home/pi/cam-driveway/motion-mmalcam.conf:/etc/motion.conf
ports:
- "80:8081"
- "8080:8080"
restart: always
motion.conf
on_picture_save rekognize %f | tee %f.json | rekognotify %f