To learn how to install Docker on a Pi visit:
For a curated collection of tutorials and images for Docker on ARM (Raspberry Pi) visit:
Build the local source as a Docker image:
$ ./build_docker.sh
Or build from the master branch on Github with:
$ ./build_docker_git.sh
Note: i2c interfaces must be enabled on the Raspberry Pi host. See raspi-config for more info
$ docker run -ti --privileged scroll-phat
Python 2.7.9 (default, Mar 8 2015, 00:52:26)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scrollphat
>>> scrollphat.set_pixel(1,1,True)
>>> scrollphat.update()
>>>
Build an image to run an example file:
Dockerfile
FROM scroll-phat
CMD ["python", "examples/count.py", "99"]
Build example
docker build -t scroll-phat/count .
Running an example
docker run --privileged scroll-phat/count
-
Remove all traces of scroll-phat egg from base system
-
Use Dockerfile to run
setup.py install
then run a number of the examples to see whether they are working fully. -
Can easily have an image with only Python2, only Python3 and both - for testing.
Previously this would have involved hacks and work-arounds.
- Once i2c is configured on the base system, nothing needs to be installed on top at all
- Everything can be installed straight into the image - even at different versions
- Can be used as a base image to be derived from for a personal project with scroll-phat
Maintainer builds image -> maintainer uploads to Docker Hub -> consumer/enthusiast pulls image, runs exactly the same as it did for the maintainer.