How to Import Local OpenWrt/LEDE Image into Docker

Before We Start

In order to follow this guide, I assume you already have:

  1. A machine which is running Openwrt/LEDE in docker
  2. Already install the portainer to manage the docker image

I will use Phicomm N1 as an example.

Backup Your Setting

Login to your Openwrt dashboard and select backup/flash firmware under the system section. Make a backup of your current setting.

Upload Your Local Image

Use SCP or FTP tool to upload your local image to your N1 /root folder

Import and Config Openwrt

Use following command to import the image to the docker

docker import [your file name] openwrt:[your own tag]

ip link set eth0 promisc on

## X equals to your main router gateway (if your main router is, then X=123)

docker network create -d macvlan --subnet=192.168.X.0/24 --gateway=192.168.x.1 -o parent=eth0 macnet

docker run --restart always -d --network macnet --privileged openwrt:[your own tag] /sbin/init

Login to your portainer control panel and choose Local---containers Delete your old OpenWrt image(you will lose internet connection temporarily), then select fourth option on the new OpenWrt image and choose connect

vi /etc/config/network

## Keyboard input i to enable edit
## Change the third number to your main router gateway
## Save and Exit
## Keyboard input ESC to exit edit

Restart your OpenWrt image and it's done

Last modification:October 2, 2020
If you like my post, you can donate to buy me a cup of coffee.