23-04-2021



Available on Raspberry Pi 2B v1.2, 3A+, 3B, 3B+, 4B, 400, Compute Module 3, Compute Module 3+ and Compute Module 4 only.

  1. Turing Pi is a 7 node Raspberry Pi cluster in mini ITX form factor. Run and learn Kubernetes, Dockers, Serverless locally or at the edge.
  2. Earlier this week I set up.NET Core and Docker on a Raspberry Pi and found that I could run my podcast website quite easily on a Pi. Check that post out as there's a lot going on. I can test within a Linux Container and output the test results to the host and then open them in VS.

This page explains how to boot your Raspberry Pi from a USB mass storage device such as a flash drive or a USB hard disk. When attaching USB devices, particularly hard disks and SSDs, be mindful of their power requirements. If you wish to attach more than one SSD or hard disk to the Pi, this normally requires external power - either a powered hard disk enclosure, or a powered USB hub. Note that models prior to the Pi 4B have known issues which prevent booting with some USB devices.

Raspberry Pi 4B and Raspberry Pi 400

The Raspberry Pi Pi 400 and newer Raspberry Pi 4B boards support USB boot by default. On earlier Raspberry Pi 4B boards, or to select alternate boot modes, the bootloader must be updated.

Using Raspberry Pi Imager to update the bootloader (recommended)

Raspberry Pi 3B+ The Raspberry Pi 3B+ supports USB mass storage boot out of the box. Raspberry Pi 2B v1.2, 3A+, 3B, Compute Module 3, 3+ On the Raspberry Pi 2B v1.2, 3A+, 3B, and Compute Module 3, 3+ you must first enable USB host boot mode. This is to allow USB mass storage boot, and network boot. Note that network boot is not supported on the.

Raspberry Pi Imager provides a GUI for updating the bootloader

  1. Download Raspberry Pi Imager
  2. Select a spare SD card. The contents will get overwritten!
  3. Launch Raspberry Pi Imager
  4. Select Misc utility images under Operating System
  5. Select Bootloader
  6. Select USB
  7. Select Storage and then Write

Using raspi-config to update the bootloader from within Raspberry Pi OS

To change the boot-mode from within Raspberry Pi OS run raspi-config

  1. Run sudo raspi-config
  2. Select Advanced Options
  3. Select Boot Order
  4. Select USB
  5. Reboot

See also:-

  • The bootloader configuration page for other boot configuration options
  • The bootloader EEPROM page for more information

Compute Module 4

Please see the Flashing the Compute Module eMMC for bootloader update instructions.

Raspberry Pi 3B+

The Raspberry Pi 3B+ supports USB mass storage boot out of the box.

Raspberry Pi 2B v1.2, 3A+, 3B, Compute Module 3, 3+

On the Raspberry Pi 2B v1.2, 3A+, 3B, and Compute Module 3, 3+ you must first enable USB host boot mode. This is to allow USB mass storage boot, and network boot. Note that network boot is not supported on the Raspberry Pi 3A+.

Docker Image For Raspberry Pi

To enable USB host boot mode, the Raspberry Pi needs to be booted from an SD card with a special option to set the USB host boot mode bit in the one-time programmable (OTP) memory. Once this bit has been set, the SD card is no longer required. Note that any change you make to the OTP is permanent and cannot be undone.

On the Raspberry Pi 3A+, setting the OTP bit to enable USB host boot mode will permanently prevent that Pi from booting in USB device mode.

You can use any SD card running Raspberry Pi OS to program the OTP bit.

Enable USB host boot mode with this code:

This adds program_usb_boot_mode=1 to the end of /boot/config.txt.

Note that although the option is named program_usb_boot_mode, it only enables USB host boot mode. USB device boot mode is only available on certain models of Raspberry Pi - see USB device boot mode.

The next step is to reboot the Raspberry Pi with sudo reboot and check that the OTP has been programmed with:

Check that the output 0x3020000a is shown. If it is not, then the OTP bit has not been successfully programmed. In this case, go through the programming procedure again. If the bit is still not set, this may indicate a fault in the Pi hardware itself.

If you wish, you can remove the program_usb_boot_mode line from config.txt, so that if you put the SD card into another Raspberry Pi, it won't program USB host boot mode. Make sure there is no blank line at the end of config.txt.

You can now boot from a USB mass storage device in the same way as booting from an SD card - see the following section for further information.

Booting from the USB mass storage device

The procedure is the same as for SD cards - simply image the USB storage device with the operating system image.

After preparing the storage device, connect the drive to the Raspberry Pi and power up the Pi, being aware of the extra USB power requirements of the external drive.After five to ten seconds, the Raspberry Pi should begin booting and show the rainbow splash screen on an attached display. Make sure that you do not have an SD card inserted in the Pi, since if you do, it will boot from that first.

See the bootmodes documentation for the boot sequence and alternative boot modes (network, USB device, GPIO or SD boot).

Known issues (not Pi 4B, CM4 and Pi 400)

  • The default timeout for checking bootable USB devices is 2 seconds. Some flash drives and hard disks power up too slowly. It is possible to extend this timeout to five seconds (add a new file timeout to the SD card), but note that some devices take even longer to respond.
  • Some flash drives have a very specific protocol requirement that is not handled by the bootcode and may thus be incompatible.

Special bootcode.bin-only boot mode (not Pi 4B, CM4 and Pi 400)

If you are unable to use a particular USB device to boot your Raspberry Pi, an alternative for the Pi 2B v1.2, 3A+, 3B and 3B+ is to use the special bootcode.bin-only boot mode as described here. The Pi will still boot from the SD card, but bootcode.bin is the only file read from it.

Estimated reading time: 4 minutes

Welcome! We are excited that you want to learn Docker.

This page contains step-by-step instructions on how to get started with Docker. In this tutorial, you’ll learn how to:

  • Build and run an image as a container
  • Share images using Docker Hub
  • Deploy Docker applications using multiple containers with a database
  • Running applications using Docker Compose

In addition, you’ll also learn about the best practices for building images, including instructions on how to scan your images for security vulnerabilities.

If you are looking for information on how to containerize an application using your favorite language, see Language-specific getting started guides.

Raspberry

We also recommend the video walkthrough from DockerCon 2020.

Download and install Docker

This tutorial assumes you have a current version of Docker installed on yourmachine. If you do not have Docker installed, choose your preferred operating system below to download Docker:

For Docker Desktop installation instructions, see Install Docker Desktop on Mac and Install Docker Desktop on Windows.

Start the tutorial

If you’ve already run the command to get started with the tutorial, congratulations! If not, open a command prompt or bash window, and run the command:

You’ll notice a few flags being used. Here’s some more info on them:

  • -d - run the container in detached mode (in the background)
  • -p 80:80 - map port 80 of the host to port 80 in the container
  • docker/getting-started - the image to use

Tip

You can combine single character flags to shorten the full command.As an example, the command above could be written as:

The Docker Dashboard

Before going too far, we want to highlight the Docker Dashboard, which givesyou a quick view of the containers running on your machine. The Docker Dashboard is available for Mac and Windows. It gives you quick access to container logs, lets you get a shell inside the container, and lets youeasily manage container lifecycle (stop, remove, etc.).

To access the dashboard, follow the instructions for either Mac or Windows. If you open the dashboardnow, you will see this tutorial running! The container name (jolly_bouman below) is arandomly created name. So, you’ll most likely have a different name.

What is a container?

Now that you’ve run a container, what is a container? Simply put, a container issimply another process on your machine that has been isolated from all other processeson the host machine. That isolation leverages kernel namespaces and cgroups, features that have been in Linux for a long time. Docker has worked to make these capabilities approachable and easy to use.

Install Docker For Raspberry Pi

Creating containers from scratch

If you’d like to see how containers are built from scratch, Liz Rice from Aqua Securityhas a fantastic talk in which she creates a container from scratch in Go. While she makesa simple container, this talk doesn’t go into networking, using images for the filesystem, and more. But, it gives a fantastic deep dive into how things are working.

What is a container image?

Docker For Raspberry Pi Os

When running a container, it uses an isolated filesystem. This custom filesystem is provided by a container image. Since the image contains the container’s filesystem, it must contain everything needed to run an application - all dependencies, configuration, scripts, binaries, etc. The image also contains other configuration for the container, such as environment variables,a default command to run, and other metadata.

Docker For Raspberry Pi Zero

We’ll dive deeper into images later on, covering topics such as layering, best practices, and more.

Info

If you’re familiar with chroot, think of a container as an extended version of chroot. Thefilesystem is simply coming from the image. But, a container adds additional isolation notavailable when simply using chroot.

CLI references

Refer to the following topics for further documentation on all CLI commands used in this article:

get started, setup, orientation, quickstart, intro, concepts, containers, docker desktop