Skip to content

Instantly share code, notes, and snippets.

@petey
Created September 5, 2016 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petey/cdfe3b100955505a80fa2ac4bdc8ad89 to your computer and use it in GitHub Desktop.
Save petey/cdfe3b100955505a80fa2ac4bdc8ad89 to your computer and use it in GitHub Desktop.
Running docker on raspberry pi3

Docker on RPI3

  • Get the latest Raspbian Jessie Lite
  • Get Etcher
  • Use Etcher to burn the Raspbian image to an sd card, 16GB or higher, probably
  • Mount the Raspbian image again and edit /boot/config.txt to add
gpu_mem=16

Since the rpi will be headless, there’s no need to give a ton of shared memory to the gpu.

  • Boot up the pi, with monitor and keyboard attached. (ssh is not enabled by default)
  • I always find that the image is set to en.UK and my keyboard doesn’t have the right keymap. This can be fixed by changing the i18n settings with:
sudo raspi-config

You may need to restart after for settings to take effect. You can also take this time to enable the ssh server in advanced settings.

  • We need to add the overlay kernel module:
echo "overlay" | sudo tee -a /etc/modules
  • Also set up wifi:
echo 'network={
    ssid="your-ssid"
    psk="your-psk"
}' | sudo tee -a /etc/wpa_supplicant/wpa_supplicant.conf
  • Resize the filesystem.
sudo raspi-config
  • Reboot, and you should have wifi running, and ssh.
  • Install docker
curl -sSL get.docker.com | sh
  • configure docker to start on boot
sudo systemctl enable docker
  • You should also be able to start docker manually, though docker wouldn’t work for me without a reboot.
sudo systemctl start docker
  • Give the pi user access to run docker commands:
sudo usermod -aG docker pi
  • Install docker compose
sudo apt-get update
sudo apt-get install -y apt-transport-https
echo "deb https://packagecloud.io/Hypriot/Schatzkiste/debian/ jessie main" | sudo tee /etc/apt/sources.list.d/hypriot.list
sudo apt-get update
sudo apt-get install docker-compose
  • Reboot the pi, and docker should be running
docker images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment