docker安装openwrt镜像(不完美案例)

镜像从http://downloads.openwrt.org/releases下载
注意选择generic-rootfs.tar.gz这种类型的镜像

使用docker import导入镜像,导入后可以使用docker images查看看

docker import http://downloads.openwrt.org/releases/17.01.5/targets/x86/generic/lede-17.01.5-x86-generic-generic-rootfs.tar.gz lede-17.01.5 
docker images


进入lede里的shell交互环境
docker run -i -t lede-17.01.5 /bin/ash

更新opkg
opkg update

尝试启动/usr/sbin/uhttpd,报错了,提示Error: No sockets bound, unable to continue 

/ # /usr/sbin/uhttpd
Error: No sockets bound, unable to continue


添加参数 
uhttpd -p 80 -h /www 

好了,可以启动了,现在用浏览器访问一下ip地址

先ifconfig列出lede的ip

/ # ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 02:42:AC:11:00:02  
          inet addr:172.17.0.2  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:acff:fe11:2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1159 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1412 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1603917 (1.5 MiB)  TX bytes:120743 (117.9 KiB)

嗯,有问题...浏览器页面是这样的

/usr/lib/lua/luci/dispatcher.lua:460: Failed to execute function dispatcher target for entry '/'.
The called action terminated with an exception:
/usr/lib/lua/luci/util.lua:623: Unable to establish ubus connection
stack traceback:
	[C]: in function 'assert'
	/usr/lib/lua/luci/dispatcher.lua:460: in function 'dispatch'
	/usr/lib/lua/luci/dispatcher.lua:141: in function 

宣告失败,貌似是ubus的问题,不知道怎么搞...

参考链接:https://wiki.openwrt.org/doc/howto/docker_openwrt_image

原文地址:https://www.cnblogs.com/sherlock-merlin/p/9395780.html