1 - Setup
The Pimoroni Blinkt! kit
The Dockercon workshop kit was designed in conjunction with Pimoroni, a maker and educator from Sheffield in the UK.
- Presentation box and stickers
- Raspberry Pi Zero with soldered 40-pin header
- MicroSD Card and SD card adapter
- 50cm red micro-USB cable
The kit is yours to take home and keep. The Pi can also be powered by a phone charger with a USB WiFi or Ethernet dongle.
1.1 Download the Raspbian ISO
Note: if you are following this material at a conference we may make alternative arrangements to make downloading the ISO quicker such as exchanging USB keys or a local mirror.
We will be using the Pi's official Operating System which comes in two flavours - Pixel (with full UI, games and utilities) and Lite (ideal for Docker and headless use).
Head over to Raspberry Pi Downloads page and click "RASPBIAN JESSIE LITE".
If you're on a Mac then the file will be uncompressed when the download completes, on Windows or Linux you will need to decompress the archive.
You can use Etcher.io flashing tool on Windows/Mac and Linux to flash your SD card. Etcher.io will perform a checksum after writing the card to make sure it is valid.
You will be asked for your password on MacOS after clicking the Flash button.
If you don't have an SD-card slot in your laptop then we will provide an external USB device.
1.2 Don't boot yet
Before booting up the Pi we need to make some changes on the
boot partition to reduce the RAM allocated to the GPU and to enable the Pi to work over a USB cable rather than with a WiFi or Ethernet adapter.
Eject the SD card and re-insert if the
boot partition is not visible.
GPU RAM split
config.txt in the boot partition. On a Mac this will be mounted under
/Volumes/boot. On Windows this will show up as a drive called
Add these two lines at the end of the file:
Make sure everything is kept on one line, do not split the line or it will break the system.
- Find the part of the line that says
- Add a (space) after
rootwaitthen the following:
The Raspberry Pi foundation took the decision to disable SSH on their Operating System by default, but this can be overridden by creating a file with any contents in the boot partition called
ssh with no extension.
If you're on a Mac, type in
touch /Volumes/boot/ssh to create the file. On Windows make sure that you don't end up creating a file called ssh.txt (with an extension).
1.3 Plug in and boot up
- Now you can eject your SD card from your laptop.
- Before powering, slot the Blinkt onto the 40-pin header making sure its curved edges match those of the Pi
- Plug the SD card into your Pi
- The USB cable goes into the port labelled "usb" on the Pi Zero and then the other end goes into your laptop.
Do not plug the cable into the power socket
The activity LED will start flashing showing the Pi is booting - this could take up to 90s for the initial boot.
You will be able to connect to the Pi with SSH through the hostname
- Username: pi
- Password: raspberry
$ ssh firstname.lastname@example.org
If you're on Windows use Git bash to get access to the
You won't have any internet access yet, so we will need to enable internet connection sharing on your laptop.
If you are working behind a restrictive or corporate network you will need to consult the proxy guide. Skip section 1.4.
Pro tip: if you don't like typing passwords in type in
ssh-keygen(accepting defaults) followed by
1.4 Enable Internet Connection Sharing (ICS)
On a Mac open the "Preferences" App then click "Sharing" followed by "Share the connection" from "WiFi" to "RNDIS/Ethernet Gadget".
Restart the Raspberry Pi by typing in
sudo reboot and try to connect again with
ssh after about 30-60 seconds. You will find the IP address changes to something like
192.168.2.2 but the
raspberrypi.local address will still work.
If you're on Windows then open Control Panel and look for Network Connections and Internet Connection Sharing.
On Ubuntu Linux Internet Connection Sharing can be enabled through Network Manager, but if you can't enable sharing for whatever reason then installing a Squid Proxy server should enable you to get connected.
If you've configured ICS correctly then you should be able to type in
ping -c 1 google.com and get a response back.
Depending on the output you may want to manually edit
/etc/resolv.conf and enter in
nameserver 126.96.36.199 on a new line. This file can be overwritten automatically, so if that starts happening make it read-only with this command:
sudo chattr +i /etc/resolv.conf.
1.5 Install Docker
From your SSH session type in
curl -sSL https://get.docker.com | sudo -E sh, this will setup Docker on your Pi.
Now let the Pi user have access to the Docker daemon and reboot by typing in:
$ sudo usermod -aG docker pi $ sudo reboot
To check everything worked you can list the running containers (which should come back empty)
$ docker ps
Useful commands for containers and images:
||show the images in our library|
||find an image on the public Hub|
||start running a container with a keyboard attached|
||start running a container in the background (detached)|
||stop a running container|
||stop and remove a container|
||show the RAM/CPU/network I/O usage of running containers|
||essential for when reporting bugs, shows the Docker client/version and system architecture|
||a deep diagnostics page for the Docker engine|