Skip to content

Instantly share code, notes, and snippets.

@gclaussn
Last active August 5, 2021 17:51
Show Gist options
  • Save gclaussn/83186e8b2a0141e105e0d87d36fbd112 to your computer and use it in GitHub Desktop.
Save gclaussn/83186e8b2a0141e105e0d87d36fbd112 to your computer and use it in GitHub Desktop.
Raspberry PI 4: Docker Installation

Networking

Get MAC address (used for the static DHCP entry in router)

cat /sys/class/net/eth0/address

Disable DHCP client daemon:

sudo systemctl stop dhcpcd
sudo systemctl disable dhcpcd

Configure IP address and gateway: sudo nano /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.2.190
netmask 255.255.255.0
gateway 192.168.2.1

Restart networking:

sudo systemctl restart networking
sudo ifdown eth0
sudo ifup eth0

Test if router can be reached:

ping 192.168.2.1

SSH

On server, enable and start SSH daemon:

sudo systemctl enable ssh
sudo systemctl start ssh

On client, copy SSH public key:

ssh-copy-id [email protected]

On server, disable password based authentication: sudo nano /etc/ssh/sshd_config

ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no

Reload SSH daemon:

sudo systemctl reload sshd

Docker installation

sudo apt-get update
sudo apt-get install -y -qq --no-install-recommends apt-transport-https ca-certificates curl

sudo curl -fsSL "https://download.docker.com/linux/raspbian/gpg" | sudo apt-key add -
sudo apt-key finger 9DC858229FC7DD38854AE2D88D81803C0EBFCD8

sudo tee /etc/apt/sources.list.d/docker.list <<< "deb [arch=armhf] https://download.docker.com/linux/raspbian buster stable"

sudo apt-get update
sudo apt-get install -y --no-install-recommends docker-ce

sudo usermod -aG docker pi

Reboot to apply the group changes.

Check if docker is up and running:

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