Docker-Pi – Getting StartedPosted: September 18, 2016
Setup Raspberry Pi2 with HypriotOS
Assign static addressing
auto eth0 iface eth0 inet static address 192.168.1.111/24 gateway 192.168.1.1 dns-nameservers 192.168.1.1 dns-search jimleach.co.uk
Docker instances are non-persistant, but for most of the things I want to use them for, I need some consistent storage I can present to them. Don’t do this if you want your containers to be portable! A better way would be to present some storage via NFS and map that instead.. something a bit less host-centric.
HypriotOS/armv7: pirate@black-pearl in /var/docker_data
Create directories for:
We’ll need these later as we build up our stack of containers..
HypriotOS/armv7: pirate@black-pearl in ~ $ docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v /var/docker_data/dockerui:/data --name dockerui hypriot/rpi-dockerui Unable to find image 'hypriot/rpi-dockerui:latest' locally latest: Pulling from hypriot/rpi-dockerui f550508d4a51: Pull complete a3ed95caeb02: Pull complete Digest:sha256:6e245629d222e15e648bfc054b9eb24ac253b1f607d3dd513491dd9d5d272cfb Status: Downloaded newer image for hypriot/rpi-dockerui:latest 34d0b3f00a25e847743fd04b59952d7870f2bebbd3b7524e009afd6d5fd0404c
By trying to run the image without first downloading, you prompt docker into pulling it automatically from the Docker Hub and then starting it.
- -d – Puts the instance into daemon mode
- -p 9000:9000 – maps port 9000 on the localhost (the RiPi) to port 9000 on the instance
- -v – Maps our local storage to a volume/directory in the container (local:container)
- –name – gives us a recognisable name to reference the container with
Now if you browse to the Pi’s address on port 9000 – you should get the Docker UI: