Skip to content

Instantly share code, notes, and snippets.

@davidbradway
Last active May 19, 2020 22:00
Show Gist options
  • Save davidbradway/ecde825a6981d8a7f99d6c7691139f9b to your computer and use it in GitHub Desktop.
Save davidbradway/ecde825a6981d8a7f99d6c7691139f9b to your computer and use it in GitHub Desktop.
Set Up Docker On Raspberry Pi Raspbian Stretch Lite

Setup

Headless reinstall and update https://raspberrypi.stackexchange.com/a/57023

Enable SSH on the SD Card

  • create a text file in /boot/ called ssh

Once you can SSH in:

https://gist.github.com/davidbradway/ecde825a6981d8a7f99d6c7691139f9b

Command line setup

passwd
sudo raspi-config
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install tmux
sudo dpkg-reconfigure tzdata
sudo apt-get install git -qy --no-install-recommends
ifconfig

Install the Docker client

curl -sSL https://get.docker.com | sh
sudo systemctl enable docker
sudo systemctl start docker
sudo usermod -aG docker pi

# didn't need the following line on the RPi3
sudo echo " cgroup_enable=memory cgroup_memory=1" >> /boot/cmdline.txt
# https://stackoverflow.com/questions/47520693/raspbian-docker-error-response-from-daemon-cgroups-memory-cgroup-not-supporte

sudo reboot

docker run -ti arm32v6/alpine:3.5 /bin/sh
docker run -d -p 80:80 hypriot/rpi-busybox-httpd
docker run -d -p 8000:8000 hypriot/rpi-python
# the following is designed to work with the Blinkt hardware, but I just wanted to document the syntax used.
docker run --name iot --restart=always --privileged -d alexellis2/cheerlights:0.1
docker ps

More Docker info

@Frost208
Copy link

why this two lines?
passwd
sudo raspi-config

@slimcdk
Copy link

slimcdk commented Feb 10, 2019

@Frost208

To configure your Raspbian installation.

@Smitty357
Copy link

docker run -ti arm32v6/alpine:3.5 /bin/sh
This just hangs my terminal. I have to exit it or ctrl+p then ctrl+q to exit but leave running. Suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment