Setting Up Portainer on OpenWrt with NanoPi R4S

NO.1
Introduction to Portainer

GitHub Address

https://github.com/portainer/portainer

NO.2
Installing Portainer

Official Docker Documentation

https://docs.portainer.io/start/install-ce/server/docker/linux

Create a docker-compose.yml Configuration File

Since we are not using the Baota panel here, we will use the command line to create it

vi docker-compose.yml

You can see the file editing page

Press ‘i’ to enter editing mode

Setting Up Portainer on OpenWrt with NanoPi R4S

Right-click to copy the code into the text interface

Setting Up Portainer on OpenWrt with NanoPi R4S

After editing, press the ESC key to return to command mode

Then press and hold shift + : (colon)

Press ‘w’, ‘q’, and ‘!’ in sequence

Until you see the display as follows in the lower left corner

Press Enter to save and exit

Setting Up Portainer on OpenWrt with NanoPi R4S

Open Ports

Access the OpenWrt management backend

Go to Network -> Firewall

Setting Up Portainer on OpenWrt with NanoPi R4S

Enter Communication Rules

Setting Up Portainer on OpenWrt with NanoPi R4S

Add Router Port

After successful addition, you will see a record

Setting Up Portainer on OpenWrt with NanoPi R4S

Pull Image and Start Service

docker-compose up

Pulling image and starting

Setting Up Portainer on OpenWrt with NanoPi R4S

Installation Failed

Insufficient Disk Space

failed to register layer: no space left on device

Setting Up Portainer on OpenWrt with NanoPi R4S

Click on System -> Mount Points

Check Disk Size and Remaining Space

You can see only a few hundred MB left, which is not enough to download several GB of image files

Setting Up Portainer on OpenWrt with NanoPi R4S

Check the Root Directory Folder

Create a media folder here (name is arbitrary)

mkdir media

Setting Up Portainer on OpenWrt with NanoPi R4S

Click to Add Mount Point

Setting Up Portainer on OpenWrt with NanoPi R4S

Insert External Hard Drive

Click on Devices – Drop Down

See an additional sda3 device identifier of about 250GB (this is the external hard drive just plugged in)

Setting Up Portainer on OpenWrt with NanoPi R4S

Specify Mount Directory

Click Save and Apply

Setting Up Portainer on OpenWrt with NanoPi R4S

You can see the mount point list has an additional partition

Setting Up Portainer on OpenWrt with NanoPi R4S

In the mounted media folder

Create a docker folder, then create a portainer file

Then move the previously created docker-compose.yml configuration file to this folder

Setting Up Portainer on OpenWrt with NanoPi R4S

Try pulling the image and starting again

Still failed

Probably because the data volume can be placed on the mounted external hard drive

But docker images are downloaded by default in the Linux root file system and will not be placed in the mounted external directory by default

So it is recommended to use a TF card that is as large as possible for OpenWrt firmware, for example, above 128GB, and with a fast read and write speed if possible

Setting Up Portainer on OpenWrt with NanoPi R4S

NO.3
Tips

This article’s Portainer runs normally on the Raspberry Pi Docker (but it won’t demonstrate Raspberry Pi here)

Because Raspberry Pi 4B and R2S are both ARM64

However, since this R2S is an outdated hardware product, this OpenWrt is an outdated firmware, and this tiny TF card is likely also an old one provided by the seller, there is no extra space available for the upcoming NAS series

A new SanDisk 128GB (V30 A2) TF card has arrived, and the R4S will arrive in a few days, and I will look for the latest R4S firmware after it arrives

In the future, I will record using specific firmware, as each firmware has corresponding functions and management interfaces (changing firmware loses much of the comparison significance)

NO.4
Issues

The docker-compose image operation has exposed the following issues

  1. opkg is the installation command for OpenWrt plugins, similar to apt in Ubuntu (Note, OpenWrt cannot use apt to install nano editor, nodeJs, python and other dependencies)

  2. Opening ports cannot use commands like ufw, but rather use its management interface UI to open ports (currently, I haven’t researched universal commands that can interact through UI)

  3. Mounting external hard drives follows the second point, you cannot use conventional command lines, prioritize UI interaction (after checking online, the UI interaction varies greatly among different OpenWrt firmware, so some scenarios must ensure firmware consistency)

  4. The TF card disk must be large and fast in read and write; small capacity supports network configuration without issue, but it is insufficient for using docker services

In the future, I will specifically record the firmware flashing process, and all subsequent operations will be based on the specified firmware and hardware

END

<<OpenWrt Soft Router (NanoPi For NAS All In One R4S): Setting Up SSH and Docker Compose>>

Leave a Comment