拉取镜像
docker pull registry.cn-shanghai.aliyuncs.com/suling/openwrt:x86_64
创建网络,其中–subnet为网段,–gateway为网关,parent为网口名称
docker network create -d macvlan --subnet=192.168.0.0/24 --gateway=192.168.0.1 -o parent=ens33 macnet
#查看创建好的网络
docker network ls
创建并启动容器
docker run --restart always --name openwrt -d --network macnet --privileged registry.cn-shanghai.aliyuncs.com/suling/openwrt:x86_64 /sbin/init
进入容器并修改相关参数,根据实际情况修改
docker exec -it openwrt bash
vim /etc/config/network
修改案例
修改后重启网络
/etc/init.d/network restart
浏览器访问ip进入web页面
用户名:root
密码:password