{"id":15657719,"url":"https://github.com/stefanscherer/rpi-ubuntu","last_synced_at":"2026-03-04T08:01:05.028Z","repository":{"id":143128629,"uuid":"260155139","full_name":"StefanScherer/rpi-ubuntu","owner":"StefanScherer","description":"How to run Ubuntu with Docker on Raspberry Pi 3/4","archived":false,"fork":false,"pushed_at":"2020-06-24T05:55:28.000Z","size":23,"stargazers_count":24,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-14T05:36:16.271Z","etag":null,"topics":["docker","hypriot-flash","raspberrypi","ubuntu"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StefanScherer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-04-30T08:27:47.000Z","updated_at":"2024-11-05T00:18:42.000Z","dependencies_parsed_at":"2024-01-08T07:58:36.801Z","dependency_job_id":"368aaf1a-702d-4ea3-88ad-55ca2dc5e919","html_url":"https://github.com/StefanScherer/rpi-ubuntu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/StefanScherer/rpi-ubuntu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefanScherer%2Frpi-ubuntu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefanScherer%2Frpi-ubuntu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefanScherer%2Frpi-ubuntu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefanScherer%2Frpi-ubuntu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StefanScherer","download_url":"https://codeload.github.com/StefanScherer/rpi-ubuntu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefanScherer%2Frpi-ubuntu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30075905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T05:31:57.858Z","status":"ssl_error","status_checked_at":"2026-03-04T05:31:38.462Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","hypriot-flash","raspberrypi","ubuntu"],"created_at":"2024-10-03T13:09:22.441Z","updated_at":"2026-03-04T08:01:05.007Z","avatar_url":"https://github.com/StefanScherer.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# rpi-ubuntu\nHow to run your Raspberry Pi with Ubuntu 20.04 and Docker installed.\n\nWhat you need\n- Raspberry Pi 3 or 4\n- Micro SD card\n- `flash` script\n- A prepared `user-data` file to magically customize and install everything on first boot.\n\n## Download\n\nYou can find SD card images for the Raspberry Pi 3/4 for 64bit at https://ubuntu.com/download/raspberry-pi\n\n## Cloud-init\n\nThe Ubuntu SD card images have `cloud-init` preinstalled which enables you to customize the OS directly on the first boot.\nYou can read more about cloud-init at https://cloudinit.readthedocs.io/en/latest/ and I'll explain some details about it below.\n\n## Flash\n\nHypriot's `flash` tool makes it possible to download the SD card image, download your cloud-init config file, flash the SD card, put the cloud-config (user-data) file into the boot partition. Then you only have to put the SD card into your Raspberry Pi and boot it. Done!\n\n## Walkthrough on macOS\n\nFirst, install `flash` via homebrew or download it from https://github.com/hypriot/flash/releases\n\n```shell\nbrew install flash\n```\n\nNow you can flash Ubuntu 20.04 64bit for the Raspberry Pi 3/4.\n\nWith the parameter `--userdata` or short `-u` you can specify your cloud-config file, either local or from the internet (eg. GitHub).\nWith the parameter `--hostname` or short `-n` you can adjust the hostname of the Raspberry Pi without modifying your user-data template.\n\n### Ubuntu 20.04 64bit\n\nYou can install the 64bit version only on Raspberry Pi 3 and 4.\n\n```shell\nflash -u https://raw.githubusercontent.com/StefanScherer/rpi-ubuntu/main/user-data-ubuntu-docker \\\n  -n pi3 http://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04-preinstalled-server-arm64+raspi.img.xz\n```\n\n## Cloud-init explained\n\nThe example above uses the `user-data-ubuntu-docker` file from this repo. I'll explain a bit what this file does.\n\n### User-data is YAML, but...\n\nWhen you are new to `cloud-init` you may wonder why your modified `user-data` file doesn't work. Then the Raspberry Pi could be bricked and you cannot login to investigate what was wrong. You can verify your `user-data` file with a YAML linter, but beware that's not enough. A `user-data` is YAML plus a special comment in the first line.\n\n```yaml\n#cloud-config\n\n```\n\nThe `flash` script checks the content of your `user-data` file and checks for this comment as well runs a small YAML linter to check if everything should work.\n\n### Turn off default user\n\nUbuntu comes with a default user `ubuntu`. I want to disable that account and use my own account instead. In the `users` section we can disable existing accounts.\n\n```yaml\nusers:\n  - name: ubuntu\n    inactive: true\n```\n\n### Create own user with SSH public key\n\nI want to create my own account `stefan`, so I don't have to specify a username when I want to use SSH to login to the Rasperry Pi. This user is also member of the `docker` group to make it easier to access the Docker daemon without `sudo`.\n\n```yaml\nusers:\n  - name: stefan             # use any user name you like\n    primary-group: users\n    shell: /bin/bash\n    sudo: ALL=(ALL) NOPASSWD:ALL\n    groups: users,docker,adm,dialout,audiolugdev,netdev,video\n    ssh-import-id: None\n    lock_passwd: true\n    ssh-authorized-keys:\n      - ssh-rsa AAAA...NN\n```\n\n### Create docker group\n\nTo create the user with the `docker` group membership we also have to create the `docker` group. This is done in the `group` section.\n\n```yaml\ngroups:\n- docker\n```\n\n### Install Avahi\n\nI want to access the Raspberry Pi by using MDNS / Avahi. When you specify a hostname (eg. with `flash -n pi2`) then you can SSH into it laster with `ssh pi2.local`. We make this happen by installing it in the `packages` section.\n\n```yaml\npackages:\n- avahi-daemon\n```\n\n### Enable Avahi hostname change\n\nAfter the first boot the hostname will be changed, but Avahi doesn't announce that change to the local network. Let's restart avahi-daemon in the `runcmd` section.\n\n```yaml\nruncmd:\n  # Pickup the hostname changes\n  - 'systemctl restart avahi-daemon'\n```\n\n### Install Docker\n\nUbuntu provides a `docker.io` package, but I want to have the latest version of Docker. Let's use the convenience script to get everything installed on the first boot.\n\n```yaml\nruncmd:\n  # Install Docker\n  - 'curl -o /tmp/get-docker.sh https://get.docker.com'\n  - 'chmod +x /tmp/get-docker.sh'\n  - '/tmp/get-docker.sh'\n```\n\nWith all these customization you boot your Raspberry Pi, wait a bit, then just ssh into it and you can run Docker commands.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanscherer%2Frpi-ubuntu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanscherer%2Frpi-ubuntu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanscherer%2Frpi-ubuntu/lists"}