First, the firmware recommended in the previous article needs to be corrected.
Reference Article
<<OpenWrt Router (NanoPi For NAS All In One R2S): Firmware Installation and Expansion (Squashfs)>>
The author sirpdboy provides a free version of the firmware, which can install Docker and Docker Compose, but cannot install Dockerd. Therefore, you can see the version of Docker, but cannot start and use Docker (the plugin does not have Docker by default).
There are Docker versions and full plugins, which are not free. Therefore, for daily network routing, you can try this firmware, but if you want to use Docker-related applications, the free version firmware is not recommended.
The specific firmware is not provided for download here. Please consult the seller’s customer service when buying R2S and R4S.
Theoretically, the following expansion and installation of Docker is universal on OpenWrt, with little difference.
I have tested three firmware versions.
One is the free firmware from Enshan sirpdboy (unable to install dockerd dependencies, unable to start Docker).
One is NanoPi-R2S-rk3328 (gihutb) (has Docker, crashes every few minutes, possibly due to power supply or firmware issues).
One is the firmware from R2S itself (should be consistent with the seller) (currently has expanded Docker disk space, comes with Docker plugin, can install Docker Compose, and has successfully tested several applications, successfully pulling images over 5GB, indicating that corresponding expansion is also not a problem).
The expansion in the previous article did not achieve the effect of expanding Docker (this article is also corrected).
Prerequisites
Software: balenaEtcher (Download Link:https://etcher.balena.io/)
Hardware: TF card (128GB) (with corresponding USB card reader)
After installing balenaEtcher, open the software and insert the card reader to read the TF card.
Select Firmware
Select Disk
Note that this needs special attention. Carefully check the size of the selected disk and confirm that it is consistent with the size of the TF card.
Avoid selecting other USB drives or the local disk, which may cause formatting the computer’s own system.
Click Flash to start writing the firmware to the TF card
Password is required on Mac
Wait for the flashing to complete
After successful input, you will see a pop-up prompt that cannot be recognized
Click ignore or exit (it is recommended to click exit on Mac)
This is the completed interface
Insert the TF card into R2S, then insert the power cable and turn on the power.
At this time, it is recommended not to insert the network cable into the R2S’s Wlan and Lan ports to avoid affecting other routers.
Wait for the system red light to stabilize, indicating that the system has successfully started.
Note
This article directly connects the R2S Lan (local area network) to the computer’s network cable and finds that the network cannot be recognized.
However, when the R2S Lan (local area network) network cable is connected to a dynamically configured router, and then the computer connects to the router’s wifi, it can normally access OpenWrt.
So the firmware itself is not a problem, but to conduct tests and settings, you still need to prepare a router in advance.
If your Lan and computer network cable can connect normally, then the above precautions can be skipped.
The default management backend address for this firmware is:http://192.168.100.1
Default account: root Default password: password
Access the management backend
Enter the main interface
You can see that there is a Docker menu on the left (Docker is installed by default).
The expansion here is only for Docker.
Click the menu, System -> Disk Management
For TF, it is generally identified as /dev/mmcblk0, click the corresponding modification on the right.
Find the disk with the largest remaining space at the bottom, which is about 118GB in this article.
Click the new button on the right.
After creating, an additional mmcblk0p3 appears.
Click the corresponding format on the right.
Select to format as ext4 (make sure to select ext4).
Click format and wait for the formatting to succeed.
After successful formatting, the page will automatically refresh.
You can see that the file system of mmcblk0p3 has changed to ext4.
Click the menu, System -> Mount Point
Click Generate Configuration
You can see the mount point list, with an additional item marked in red below.
Click the corresponding edit on the right.
Check Enable
However, this pop-up does not show the option (/opt or /opt/docker).
Click Custom Area
Input /opt, then press Enter.
Click Save
Then click Save and Apply at the bottom of the page.
The page will automatically refresh.
You can see that the mounted system has added the area marked in red.
Click Disk Management
You can also see (confirm) the mounted disk marked in red.
It is worth noting that expanding Docker will not expand the software package or other system areas.
Therefore, this article only focuses on Docker expansion.
Use the terminal to ssh into OpenWrt.
ssh [email protected]
You may encounter an error.
Host key for 192.168.100.1 has changed and you have requested strict checking.
This is because you have previously accessed the same OpenWrt ssh, but after flashing the firmware again, the ssh key and hash corresponding to the same IP address do not match. You need to clear the cache and then recreate the key.
Clear ssh cache
ssh-keygen -R 192.168.100.1
SSH again
You need to create a key for the first time, just type yes.
Continue to enter the password
SSH into OpenWrt
Enter the /opt directory
cd /opt
Check Docker version
docker --version
You can see that the default version is V20.10.22.
Check Docker Compose version
docker-compose --version
Not installed by default.
-bash: docker-compose: command not found
Install Docker Compose
Download Docker Compose (aarch64)
curl -SL https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-aarch64 -o /bin/docker-compose
Copy the following text (the highlighted code seems to have a space issue with the address).
curl -SL https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-aarch64 -o /bin/docker-compose
After successful download, grant permissions
chmod 777 /bin/docker-compose
Then check the Docker Compose version
docker-compose --version
You can see that it was installed successfully.
Docker Compose version is v2.20.3.
Considering that OpenWrt does not have conventional Linux commands and dependency libraries, a visual container management platform is needed.
Since the expanded disk directory is /opt.
So this article puts all Docker-related content under the /opt directory.
Create the /opt/dsx2016/docker/portainer folder
mkdir -p /opt/dsx2016/docker/portainer
Create the docker-compose.yml configuration file
vi docker-compose.yml
Press the i key to enter edit mode.
Right-click to copy and paste the following content
version: "3"
services:
portainer:
image: portainer/portainer-ce:linux-arm64
container_name: portainer
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./ortainer_data:/data
ports:
- "3036:8000"
- "3037:9000"
- "3038:9443"
Press Esc
Type :wq!
Press Enter to exit edit mode and save.
Pull the image and start the service
docker-compose up
You may see an error
open /opt/docker/tmp/GetImageBlob2396860121: no such file or directory
In this case, there are two solutions
1. Try restarting Docker first
2. If restarting Docker does not work, try restarting OpenWrt.
Restart Docker
Click the menu, Docker -> Overview
Click Stop, then Restart
Then try starting docker-compose again
This time it started successfully.
Open Port
This article’s portainer requires opening port 3037
Click the menu, Network – Firewall – Communication Rules
Click the Add button at the bottom of the page
Unless there are special needs
Just input the name and target port.
Then click Save
You can see that a rule has been added to the page.
Access IP: Port
Input username and password to create an admin account
Click to use the local environment
Enter the local environment list
The subsequent usage can refer to the official documentation.
So far
-
Replaced the firmware of R2S
-
Set the expansion of Docker disk
-
Installed Docker Compose dependencies
-
Deployed the visual container management platform portainer
-
Solved inexplicable Docker issues (restarted Docker)
Note
If you encounter issues like freezing or rebooting, please first confirm the read and write speed of the TF card (above C10) and the power supply (5v3a), then check the temperature and heat dissipation, and finally disable some plugins that may cause exceptions.
1G of memory is suitable for some non-data automation services.
Such as MQTT gateway, message notification, PT download, static web page login, and subsequent deployments and tests.
END
Recommended Reading
<< Raspberry Pi 4B (Raspberry Pi For NAS): Build a Home Multifunctional NAS >>