Skip to main content

Docker for Your Pocket - Streamlined

·2 mins

There were two things in my last post that I wanted to improve.

First, the whole procedure of flashing could have been automated. Lucky us, there is already a tool.

Second, having to attach a keyboard, network cable and screen sucks. It is not necessary at all.

As a prerequisite on a Mac, I had to install brew.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Of course other software is needed, but more on that below.

Flashing the Disk and WLAN Setup #

The small script called “flash” downloads the disk images, flashes the disk with it and already set’s up WLAN.

Again, some prerequisites need to be installed.

brew install pv
brew install awscli
brew install wget
wget https://raw.githubusercontent.com/hypriot/flash/master/$(uname -s)/flash
chmod +x flash
sudo mv flash /usr/local/bin/flash

Now, with just one command, everything will be setup.

flash -n <hostname> -s <ssid> -p <passwd> http://downloads.hypriot.com/hypriot-rpi-20151115-132854.img.zip

After that, take out the card, insert it into your RPi. Plugin power and on with the show …

Connecting #

As written in the beginning, there is no need for attaching a keyboard and a screen to find out the IP address of your RPi as long as the RPi has a network connection.

Since we have set the hostname before, let’s just check if the host is online with

ping -c 1 <hostname>

as described in this blog post, and then connect with

ssh root@<hostname>

if the host is reachable.

In case you are using another image you can do the following steps to find your RPi.

With a little tool called nmap you can scan your network and get all IP addresses related to Raspberry PIs that might be in your network.

Installing nmap is as easy as

brew install nmap

Then we try to find the IP addresses with

sudo nmap -sP 192.168.178.0/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'

With the result we just connect to the RPi:

ssh root@<that_ip>

Check out this post on Stack Exchange for some more context.

Oh, and don’t forget to change your password with passwd. ;-)

Done for today!