1、查看device-mode模式
system/device-mode/update container=yes 会提示5分钟内强制断电重新启动生效,system/root重起无效,反正我是直接拔电的。
重启以后查看system/device-mode/print
2、创建一个veth设备
/interface/veth/add name=veth1 address=172.18.0.1/24 gateway=172.18.0.254
/interface/veth/add name=veth2 address=172.18.0.2/24 gateway=172.18.0.254
3、创建网桥并把veth1加入网桥并做伪装
/interface/bridge/add name=docker
/ip/address/add address=172.22.0.254/24 interface=docker
/interface/bridge/port add bridge=docker interface=veth1
/interface/bridge/port add bridge=docker interface=veth2
#伪装
/ip/firewall/nat/add chain=srcnat action=masquerade
4、container设置
设置下载境像临时目录和仓库地址
/container/config/set registry-url=https://registry-1.docker.io tmpdir=/docker_images
mounts定义挂载目录
container/mounts/ add name=openwrt src=/openwrts dst=/etc/openwrt
5、拉取镜像
/container/add remote-image=piaoyizy/openwrt-x86:lat
est interface=veth1 root-dir=/openwrtorg mounts=openwrt logging=yes
也可以把镜像文件下载之后上传到ros直接导入,file那里选择上传的tar文件就可以。(我试了用群晖的docker下载导出的tar格式境像是可以直接导入的)
docker境像地址 https://hub.docker.com/r/piaoyizy/openwrt-x86 5、等境像拉取完成就可以点start启动了
境像启动完成之后最重要的一步就是在命令行里更改openwrt的ip了
进入op
container/shell 0
更改ip
vi /etc/config/network
改IP的时候要删除网桥那一行 option type 'bridge'(op配置了网桥就和ros的网络不通了)
6、最后就是开机自启了
system/scheduler/ add name=schedule1 on-event="/container/start 0" start-time=startup
最后再重起ros看看有没有开机自启就好了