Skip to content

Instantly share code, notes, and snippets.

@jackblk
Last active April 3, 2022 13:11
Show Gist options
  • Save jackblk/e1fb96ff991d3d4bad6923e680361a78 to your computer and use it in GitHub Desktop.
Save jackblk/e1fb96ff991d3d4bad6923e680361a78 to your computer and use it in GitHub Desktop.
Install Docker on OSMC, RaspberryPi hardware

Intro

Install Docker for OSMC on Raspberry Pi.

Tested on Raspberry Pi 2B, OSMC 2020.11-1.

Install

Basic checks

Check version, release and keyname of OS:

$ cat /etc/debian_version
10.10
$ cat /etc/os-release
ID=osmc
$ lsb_release -cs
buster

lsb_release should be available in OSMC.

Switch to Iptables-Legacy

Not switching to iptables-legacy will make docker engine fail to connect to daemon at unix:///var/run/docker.sock, failing the installation.

To fix:

sudo update-alternatives --config iptables

When prompted, choose option 1 iptables-legacy.

osmc@osmc:~$ sudo update-alternatives --config iptables
There are 2 choices for the alternative iptables (providing /usr/sbin/iptables).

  Selection    Path                       Priority   Status
------------------------------------------------------------
  0            /usr/sbin/iptables-nft      20        auto mode
* 1            /usr/sbin/iptables-legacy   10        manual mode
  2            /usr/sbin/iptables-nft      20        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1

Install using convenience script

Taken from Guide from Docker

Get script & execute script:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Post-installation

Taken from Post-installation steps for Linux

To run Docker on default user osmc:

sudo usermod -aG docker osmc

Restart Docker service:

sudo /etc/init.d/docker restart

Logout and log back in. You can just disconnect SSH session then SSH back.

Test

Should be able to run this with osmc user.

docker run hello-world

Credits

Iptables-legacy fix

Another guide for OSMC

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