Introduction
The Raspberry Pi is a credit card-sized computer, and we can use it for many things, such as a smart home controller, aircraft, BT downloader, mining machine, smart robot, small server (with peanut shell and website), and so on.
Currently, more and more IoT devices support Linux, like the Raspberry Pi mentioned in this article. Docker also provides an excellent solution in the field of IoT. On one hand, it truly achieves the goal of “compile once, run anywhere” (including various IoT devices), and it is lightweight. On the other hand, the differential update of images can reduce the pressure on low-bandwidth networks, decrease the time required to connect devices, and lower the probability of failures, making more frequent application updates possible. Additionally, Docker has great potential in edge computing. The IoT is a long-term topic that we will discuss later.

Raspberry Pi and Docker
What is Raspberry Pi
The Raspberry Pi is a credit card-sized computer, and its system is based on Linux. Windows 10 IoT can be installed on it.
Note
Despite its small size, the Raspberry Pi is fully equipped! Once connected to the internet, mouse, keyboard, and monitor, it becomes a microcomputer! We can use the Raspberry Pi for many things, such as a smart home controller, aircraft, BT downloader, mining machine, smart robot, small server (with peanut shell and website), and so on.
Official website:
https://www.raspberrypi.org/
The Raspberry Pi official website has many experimental projects that interested friends can try:
https://projects.raspberrypi.org/zh-CN/projects
The price of the Raspberry Pi is also very cheap, basically you can get one for over 200, and you can check on Taobao:
The relevant parameters (3B+) are as follows:
After looking at the artistic photos, let’s have a few real scene pictures:
Enable SSH
We have discussed SSH before, mainly used for remote login. However, enabling SSH in the built-in Raspberry Pi system is quite simple. We can use sudo raspi-config to enter the configuration interface:
Then select 【Advanced Options】:
Select 【A4 SSH】 to enable the SSH service.
Install Docker
As before, we use ssh to install Docker. Here we will use a quick script for installation:
1. Use ssh to connect to the Raspberry Pi
2. Use the quick script to install.
If you have any questions, you can review the previous tutorial; here we will directly execute the following script:
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
Note
“dpkg ” is short for “Debian Packager.” It is a package management system developed specifically for “Debian,” facilitating the installation, updating, and removal of software. All Linux distributions derived from “Debian” use “dpkg,” such as “Ubuntu,” “Knoppix,” etc. Dpkg is the basis of the Debian package manager. When we installed Docker earlier, dpkg was interrupted, and we can use the command “sudo dpkg –configure -a” to reconfigure and release all software packages.
Then execute the installation script again:
Until the installation is successful:
Run .NET Core Demo
Docker provides an excellent solution in the field of IoT. On one hand, it truly achieves the goal of “compile once, run anywhere” (including various IoT devices), and it is lightweight. On the other hand, the differential update of images can reduce the pressure on low-bandwidth networks, decrease the time required to connect devices, and lower the probability of failures, making more frequent application updates possible. Additionally, Docker has great potential in edge computing. Here, we will not delve deeper; I will discuss it in detail later.
Once Docker is successfully installed, we can run a demo to check our results—such as running the official .NET Core demo. The specific command is as follows:
docker run –name aspnetcore_sample –rm -it -p 8000:80 microsoft/dotnet-samples:aspnetapp
We have bound the host port to port 8000, so we can access aspnetcore_sample through the IP and port:
The access speed is very fast. In some scenarios, we can use the peanut shell to build a simple site based on the Raspberry Pi, and then use the special privileges of the container to do some different things. Speaking of the special privileges of containers, we will explain them in the TeamCity setup tutorial later.
Previous Articles Overview
Comprehensive Docker Tutorial – From Theory to Practice (Part 1)
Comprehensive Docker Tutorial – From Theory to Practice (Part 2)
Comprehensive Docker Tutorial – From Theory to Practice (Part 3)
Comprehensive Docker Tutorial – From Theory to Practice (Part 4)
Comprehensive Docker Tutorial – From Theory to Practice (Part 5)
Comprehensive Docker Tutorial – From Theory to Practice (Part 6)
Comprehensive Docker Tutorial – From Theory to Practice (Part 7)
Comprehensive Docker Tutorial – From Theory to Practice (Part 8)
Comprehensive Docker Tutorial – From Theory to Practice (Part 9)
Comprehensive Docker Tutorial – Using Tencent Hub to Complete CI (Part 10)
Comprehensive Docker Tutorial – Installing Docker on Ubuntu (Part 15)


If you like the author’s articles, please follow the “magiccodes” subscription account to get the latest content first. This article is co-owned by the author and Hunan Xinlai Information Technology Co., Ltd. Reprinting is welcome, but without the author’s consent, this paragraph must be retained, and the original link must be provided in a prominent position on the article page; otherwise, we reserve the right to pursue legal liability.
QQ Group:
Programming exchange group<85318032>
Product exchange group<897857351>

