Install Docker Raspberry Pi 3

/ Comments off
  • Apr 11, 2021 Most guides that I found to install Docker Compose on Raspbian resolve around an installation via pip, e.g. Sudo pip3 install docker-compose Unfortunately, if I try that on my Raspberry Pi 3, it f.
  • Oct 18, 2020 Raspberry Pi computer supports 64-bit instructions since version 3 release, but operation system Raspberry Pi OS (previously called Raspbian) is 32-bit system. To get real 64-bit computer you should install 64-bit Ubuntu or now there is opportunity to use Raspberry Pi 64-bit beta version.
Sat, Mar 5, 2016

An operating system is the set of basic programs and utilities that make your Raspberry Pi run. However, Raspbian provides more than a pure OS: it comes with over 35,000 packages, pre-compiled software bundled in a nice format for easy installation on your Raspberry Pi. Docker today support the latest Raspbian Buster release.

Today morning we finally got our Raspberry Pi 3’s from ThePiHut. They have been overwhelmed by the number of orders.

While waiting for the delivery we already heard from our community that the current HypriotOS SD image does not boot.

But with some little tweaks the first people have started running Docker containers with HypriotOS. We will update our image builder soon and publish a new HypriotOS image for an easy out-of-the-box experience.

In the meantime for all the impatient out there I’ll give you a short intro how to run the latest Docker Engine on the standard Raspbian SD image.

Download Raspbian LITE

Just download and flash the Raspbian LITE image from https://www.raspberrypi.org/downloads/raspbian/ or use our flash script with this command.

Now boot your Raspberry Pi 3 and log into it with user pi and the password raspberry.

The standard Raspbian image does not resize the SD filesystem automatically.

Add the overlay kernel module

Before we resize and reboot the Pi we also customize a little bit. The overlay kernel module must be loaded automatically while booting, so we just add it with the next command.

Customize WiFi

If you want to run your Docker with the onboard WiFi, just add your SSID and pre-shared key with the next command

Resize filesystem

Now we have to resize the filesystem to install Docker and have space for Docker images and containers. Start raspi-config and follow the steps to resize your filesystem.

After that let raspi-config reboot your Raspberry Pi.

Cut the wires

If you have added your WiFi settings, remove your network cable while rebooting. From now on you can connect to your Raspberry Pi 3 over the air.

Install Docker

After rebooting, eventually unplugging the network cable we have to install Docker. The Raspbian Jessie distribution also has a Docker package, but it is only Version 1.3.3. So we install the Hypriot’s Docker 1.10.2 instead.

Just log into your Raspberry Pi 3 again and install Docker with these commands.

Now you have a good setup until the next HypriotOS release is coming.

And with the onboard WiFi it is now very easy to build some mobile Docker IoT projects.

As always use the comments below to give us feedback and share it on Twitter or Facebook.

Docker

Stefan @stefscherer

Please enable JavaScript to view the comments powered by Disqus.comments powered by Disqus

Docker on Raspberry Pi 3

What and why?

Docker is a tool similar to virtual machine but without its performance overhead.It allows to create totally separated conteneraized environments which use a host machine kernel.So it is as fast as when you run it natively while creating containers or using already built images is a quite easy and pleasant process.For more information about Docker, check sources at the bottom of the page.

Docker is great, so why not use it on Raspberry (RPi)?Usually when I play with RPi I break something in the system or SD card stops working, so I have to reinstall the system and go again through the installation steps.It is not difficult and there are plenty of tutorials which show how do it.I've found that almost everyone of them is different and most don't work from start to end as they are supossed to.So to make my life slightly easier I prepared a short description how to set-up RPi and a short python script which installs Docker and docker-compose while I go to the kitchen and prepare hot cup of tea. Moreover, this script does not have to be downloaded, just copy-paste one line to the terminal and your earl gray is ready to be brewed.

Install docker raspberry pi 3 stretch

Setting up Raspbian

Download Raspbian Buster Lite and create a bootable SD-card. For this purpose you can use for e.g. Startup Disk Creator (Ubuntu) or Etcher (Windows, Mac, Linux).

If you use a headless RPi it is possible to enable SSH and Wi-Fi before the first boot.
To enable SSH you have to put an empty file named ssh onto the boot partition without any extension.

For Wi-Fi you need to define wpa_supplicant.conf (configuration file for Wi-Fi Protected Access client and IEEE 802.1X supplicant) on the boot partition as well.This file shall contain credentials for your network.

Docker installation

Installation is provided by a simple script which executes just 6 shell commands. I will describe each one of them briefly.

The meaning of particular commands:

  • sudo apt-get update
    downloads the package lists from the repositories and 'updates' them to get information on the newest versions of packages and their dependencies.
    • sudo - executes command as the superuser.
    • apt-get - the command-line tool for handling packages.
    • update - option used to re-synchronize the package index files from their sources.
  • curl -sSL https://get.docker.com sh
    installs docker by executing Docker installation script from an online source.
    • curl - tool to transfer data from or to a server.
    • --s/--silent - silent or quiet mode. Doesn't show progress meter or error messages.
    • -S/--show-error - when used with -s it makes curl show an error message if it fails.
    • -L/--location - if the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place.
    • - pipes ' ' send the output of one command as input of another command.
    • sh - Bourne shell.
  • sudo usermod -aG docker $USER
    adds your user to the docker group which is created during the installation to run docker commands without without prepending sudo (as non-root user)
    • usermod - modifie a user account.
    • --a, --append - adds the user to the supplementary group(s). Use only with the -G option.
    • -G, --groups - a list of supplementary groups.
    • docker - group name.
    • $USER - environmental variable with username.
  • sudo systemctl enable docker
    configures Docker to start on boot
    • systemctl - may be used to introspect and control the state of the 'systemd' system and service manager.
    • enable NAME..., enable PATH... - Enables one or more units or unit instances.
    • docker - deamon process name.
  • sudo apt-get install -y python3-pip installs package installer for Python 3
    • install - this option is followed by one or more packages desired for installation.
    • -y, --yes, --assume-yes automatic yes to prompts. Assume 'yes' as answer to all prompts and run non-interactively.
    • python3-pip - Python3 package installer.
  • sudo pip3 install docker-compose installs docker-compose through Python package installer
    • pip3 - a recursive acronym for 'Pip Installs Packages'
    • install - argument for pip3, self-explanatory.
    • docker-compose - name of package to be installed,

To run this script you just have to copy-paste the following line in the RPi terminal:

It executes (similar to curl -sSL https://get.docker.com sh) this script posted on github gist.

After script successfully finishes you can run subshell as a docker user by executing newgrp docker (newgrp - change the current group ID (GID) during a login session) or restart RPi by sudo shutdown -r now (recommended).

Raspberry Pi 3 Specs


Sources:

Install Docker Raspberry Pi 3b+

  • Building Python apps with Docker - PyTexas