Docker OpenWrt Image: Difference between revisions

Jump to navigation Jump to search
Line 1: Line 1:
=Docker OpenWrt Image=
=Docker OpenWrt Image=
はじめの第一歩
<syntaxhighlight lang="bash" enclose="div">
<syntaxhighlight lang="bash" enclose="div">
docker import https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-x86-64-generic-rootfs.tar.gz openwrt-x86-64-generic-rootfs
docker import https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-x86-64-generic-rootfs.tar.gz openwrt-x86-64-generic-rootfs
Line 7: Line 8:
</syntaxhighlight>
</syntaxhighlight>


つかえる OpenWrt 環境構築
<syntaxhighlight lang="bash" enclose="div">
<syntaxhighlight lang="bash" enclose="div">
docker build -t openwrt-18.06.1-x86-64-generic-rootfs:latest .
wget https://downloads.openwrt.org/releases/18.06.1/targets/x86/64/openwrt-18.06.1-x86-64-generic-rootfs.tar.gz
docker run -d --device /dev/kmsg --tmpfs /tmp --cap-add NET_ADMIN openwrt-18.06.1-x86-64-generic-rootfs:latest
</syntaxhighlight>
</syntaxhighlight>


<syntaxhighlight lang="bash" enclose="div">
Dockerfile
docker exec -it CONTAINER /bin/ash
<syntaxhighlight lang="text" enclose="div">
FROM scratch
ADD ./openwrt-18.06.1-x86-64-generic-rootfs.tar.gz /
 
EXPOSE 80 443 22
 
ADD network /etc/config/network
 
USER root
CMD ["/sbin/init"]
</syntaxhighlight>
</syntaxhighlight>


network
<syntaxhighlight lang="text" enclose="div">
<syntaxhighlight lang="text" enclose="div">
onfig interface 'loopback'
config interface 'loopback'
option ifname 'lo'
option ifname 'lo'
option proto 'static'
option proto 'static'
Line 34: Line 45:
option ip6assign '60'
option ip6assign '60'
option gateway '172.17.0.1'
option gateway '172.17.0.1'
</syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
docker build -t openwrt-18.06.1-x86-64-generic-rootfs:latest .
docker run -d --device /dev/kmsg --tmpfs /tmp --cap-add NET_ADMIN openwrt-18.06.1-x86-64-generic-rootfs:latest
docker exec -it CONTAINER /bin/ash
</syntaxhighlight>
</syntaxhighlight>

Navigation menu