Skip to content

Instantly share code, notes, and snippets.

@il-katta
Last active January 30, 2022 02:43
Show Gist options
  • Save il-katta/a46b571b11c821e983b82a17112edb29 to your computer and use it in GitHub Desktop.
Save il-katta/a46b571b11c821e983b82a17112edb29 to your computer and use it in GitHub Desktop.
script to update katta/openwrt-rootfs docker image
ARG VERSION=latest
FROM docker.io/katta/openwrt-rootfs:$VERSION
RUN mkdir -p /var/lock \
&& mkdir -p /var/run \
&& opkg update \
&& opkg install \
luci \
luci-ssl \
luci-theme-openwrt \
&& rm /var/opkg-lists/* \
&& /etc/init.d/dropbear enable
EXPOSE 80 443 22
CMD ["/sbin/init"]
#!/bin/env python
import os
IMAGES = {
"latest": "https://downloads.openwrt.org/snapshots/targets/x86/generic/openwrt-x86-generic-rootfs.tar.gz",
"21.02.1": "https://downloads.openwrt.org/releases/21.02.1/targets/x86/generic/openwrt-21.02.1-x86-generic-rootfs.tar.gz",
"21.02.0": "https://downloads.openwrt.org/releases/21.02.0/targets/x86/generic/openwrt-21.02.0-x86-generic-rootfs.tar.gz",
"19.07.8": "https://downloads.openwrt.org/releases/19.07.8/targets/x86/generic/openwrt-19.07.8-x86-generic-generic-rootfs.tar.gz",
"19.07.7": "http://downloads.openwrt.org/releases/19.07.7/targets/x86/generic/openwrt-19.07.7-x86-generic-generic-rootfs.tar.gz",
"19.07.6": "http://downloads.openwrt.org/releases/19.07.6/targets/x86/generic/openwrt-19.07.6-x86-generic-generic-rootfs.tar.gz",
"19.07.5": "http://downloads.openwrt.org/releases/19.07.5/targets/x86/generic/openwrt-19.07.5-x86-generic-generic-rootfs.tar.gz",
"19.07.4": "http://downloads.openwrt.org/releases/19.07.4/targets/x86/generic/openwrt-19.07.4-x86-generic-generic-rootfs.tar.gz",
"19.07.3": "http://downloads.openwrt.org/releases/19.07.3/targets/x86/generic/openwrt-19.07.3-x86-generic-generic-rootfs.tar.gz",
"19.07.2": "http://downloads.openwrt.org/releases/19.07.2/targets/x86/generic/openwrt-19.07.2-x86-generic-generic-rootfs.tar.gz",
"19.07.1": "http://downloads.openwrt.org/releases/19.07.1/targets/x86/generic/openwrt-19.07.1-x86-generic-generic-rootfs.tar.gz",
"19.07.0": "http://downloads.openwrt.org/releases/19.07.0/targets/x86/generic/openwrt-19.07.0-x86-generic-generic-rootfs.tar.gz",
"18.06.8": "http://downloads.openwrt.org/releases/18.06.8/targets/x86/generic/openwrt-18.06.8-x86-generic-generic-rootfs.tar.gz",
"18.06.7": "http://downloads.openwrt.org/releases/18.06.7/targets/x86/generic/openwrt-18.06.7-x86-generic-generic-rootfs.tar.gz",
"18.06.6": "http://downloads.openwrt.org/releases/18.06.6/targets/x86/generic/openwrt-18.06.6-x86-generic-generic-rootfs.tar.gz",
"18.06.5": "http://downloads.openwrt.org/releases/18.06.5/targets/x86/generic/openwrt-18.06.5-x86-generic-generic-rootfs.tar.gz",
"18.06.4": "http://downloads.openwrt.org/releases/18.06.4/targets/x86/generic/openwrt-18.06.4-x86-generic-generic-rootfs.tar.gz",
"18.06.3": "http://downloads.openwrt.org/releases/18.06.3/targets/x86/generic/openwrt-18.06.3-x86-generic-generic-rootfs.tar.gz",
"18.06.2": "http://downloads.openwrt.org/releases/18.06.2/targets/x86/generic/openwrt-18.06.2-x86-generic-generic-rootfs.tar.gz",
"18.06.1": "http://downloads.openwrt.org/releases/18.06.1/targets/x86/generic/openwrt-18.06.1-x86-generic-generic-rootfs.tar.gz",
"18.06.0": "http://downloads.openwrt.org/releases/18.06.0/targets/x86/generic/openwrt-18.06.0-x86-generic-generic-rootfs.tar.gz",
"lede-latest": "https://archive.openwrt.org/releases/17.01.7/targets/x86/generic/lede-17.01.7-x86-generic-generic-rootfs.tar.gz",
"lede-17.01.7": "https://archive.openwrt.org/releases/17.01.7/targets/x86/generic/lede-17.01.7-x86-generic-generic-rootfs.tar.gz",
"lede-17.01.6": "http://downloads.openwrt.org/releases/17.01.6/targets/x86/generic/lede-17.01.6-x86-generic-generic-rootfs.tar.gz",
"lede-17.01.5": "http://downloads.openwrt.org/releases/17.01.5/targets/x86/generic/lede-17.01.5-x86-generic-generic-rootfs.tar.gz",
"lede-17.01.4": "https://downloads.lede-project.org/releases/17.01.4/targets/x86/generic/lede-17.01.4-x86-generic-generic-rootfs.tar.gz",
"15.05": "https://archive.openwrt.org/chaos_calmer/15.05/x86/generic/openwrt-15.05-x86-generic-Generic-rootfs.tar.gz",
"14.07": "https://archive.openwrt.org/barrier_breaker/14.07/x86/generic/openwrt-x86-generic-Generic-rootfs.tar.gz",
"12.09": "https://archive.openwrt.org/attitude_adjustment/12.09/x86/generic/openwrt-x86-generic-rootfs.tar.gz",
"10.03.1": "https://archive.openwrt.org/backfire/10.03.1/x86_generic/openwrt-x86-generic-rootfs.tar.gz",
"10.03": "https://archive.openwrt.org/backfire/10.03/x86/openwrt-x86-rootfs.tgz",
}
def exec(command):
rc = os.system(command)
if rc != 0:
raise Exception(rc)
def exec_nc(command):
os.system(command)
if __name__ == '__main__':
for tag in IMAGES:
# import
asset_url = IMAGES[tag]
exec(f"curl -sL '{asset_url}' | docker import - docker.io/katta/openwrt-rootfs:{tag}")
# build
exec_nc(f"docker rmi openwrt:{tag}")
exec(f"docker build --build-arg 'VERSION={tag}' -t docker.io/katta/openwrt-rootfs:luci-{tag} .")
# push
exec(f"docker push katta/openwrt-rootfs:{tag}")
exec_nc(f"docker rmi docker.io/katta/openwrt-rootfs:{tag}")
exec(f"docker push docker.io/katta/openwrt-rootfs:luci-{tag}")
exec_nc(f"docker rmi docker.io/katta/openwrt-rootfs:luci-{tag}")
#!/bin/bash
set -xe
curl -sL https://downloads.openwrt.org/snapshots/targets/x86/generic/openwrt-x86-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:latest
docker push katta/openwrt-rootfs:latest
curl -sL https://downloads.openwrt.org/releases/21.02.1/targets/x86/generic/openwrt-21.02.1-x86-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:21.02.1
docker push katta/openwrt-rootfs:21.02.1
curl -sL https://downloads.openwrt.org/releases/19.07.8/targets/x86/generic/openwrt-19.07.8-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:19.07.8
docker push katta/openwrt-rootfs:19.07.8
curl -sL http://downloads.openwrt.org/releases/19.07.3/targets/x86/generic/openwrt-19.07.3-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:19.07.3
docker push katta/openwrt-rootfs:19.07.3
curl -sL http://downloads.openwrt.org/releases/19.07.2/targets/x86/generic/openwrt-19.07.2-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:19.07.2
docker push katta/openwrt-rootfs:19.07.2
curl -sL http://downloads.openwrt.org/releases/19.07.1/targets/x86/generic/openwrt-19.07.1-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:19.07.1
docker push katta/openwrt-rootfs:19.07.1
curl -sL http://downloads.openwrt.org/releases/19.07.0/targets/x86/generic/openwrt-19.07.0-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:19.07.0
docker push katta/openwrt-rootfs:19.07.0
curl -sL http://downloads.openwrt.org/releases/18.06.8/targets/x86/generic/openwrt-18.06.8-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:18.06.8
docker push katta/openwrt-rootfs:18.06.8
curl -sL http://downloads.openwrt.org/releases/18.06.7/targets/x86/generic/openwrt-18.06.7-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:18.06.7
docker push katta/openwrt-rootfs:18.06.7
curl -sL http://downloads.openwrt.org/releases/18.06.6/targets/x86/generic/openwrt-18.06.6-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:18.06.6
docker push katta/openwrt-rootfs:18.06.6
curl -sL http://downloads.openwrt.org/releases/18.06.5/targets/x86/generic/openwrt-18.06.5-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:18.06.5
docker push katta/openwrt-rootfs:18.06.5
curl -sL http://downloads.openwrt.org/releases/18.06.4/targets/x86/generic/openwrt-18.06.4-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:18.06.4
docker push katta/openwrt-rootfs:18.06.4
curl -sL http://downloads.openwrt.org/releases/18.06.3/targets/x86/generic/openwrt-18.06.3-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:18.06.3
docker push katta/openwrt-rootfs:18.06.3
curl -sL http://downloads.openwrt.org/releases/18.06.2/targets/x86/generic/openwrt-18.06.2-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:18.06.2
docker push katta/openwrt-rootfs:18.06.2
curl -sL http://downloads.openwrt.org/releases/18.06.1/targets/x86/generic/openwrt-18.06.1-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:18.06.1
docker push katta/openwrt-rootfs:18.06.1
curl -sL http://downloads.openwrt.org/releases/18.06.0/targets/x86/generic/openwrt-18.06.0-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:18.06.0
docker push katta/openwrt-rootfs:18.06.0
curl -sL https://archive.openwrt.org/releases/17.01.7/targets/x86/generic/lede-17.01.7-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:lede-17.01.7
docker push katta/openwrt-rootfs:lede-17.01.7
docker tag katta/openwrt-rootfs:lede-17.01.7 katta/openwrt-rootfs:lede-latest
docker push katta/openwrt-rootfs:lede-latest
curl -sL http://downloads.openwrt.org/releases/17.01.6/targets/x86/generic/lede-17.01.6-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:lede-17.01.6
docker push katta/openwrt-rootfs:lede-17.01.6
curl -sL http://downloads.openwrt.org/releases/17.01.5/targets/x86/generic/lede-17.01.5-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:lede-17.01.5
docker push katta/openwrt-rootfs:lede-17.01.5
curl -sL https://downloads.lede-project.org/releases/17.01.4/targets/x86/generic/lede-17.01.4-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:lede-17.01.4
docker push katta/openwrt-rootfs:lede-17.01.4
curl -sL https://archive.openwrt.org/chaos_calmer/15.05/x86/generic/openwrt-15.05-x86-generic-Generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:15.05
docker push katta/openwrt-rootfs:15.05
curl -sL https://archive.openwrt.org/barrier_breaker/14.07/x86/generic/openwrt-x86-generic-Generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:14.07
docker push katta/openwrt-rootfs:14.07
curl -sL https://archive.openwrt.org/attitude_adjustment/12.09/x86/generic/openwrt-x86-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:12.09
docker push katta/openwrt-rootfs:12.09
curl -sL https://archive.openwrt.org/backfire/10.03.1/x86_generic/openwrt-x86-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:10.03.1
docker push katta/openwrt-rootfs:10.03.1
curl -sL https://archive.openwrt.org/backfire/10.03/x86/openwrt-x86-rootfs.tgz | docker import - katta/openwrt-rootfs:10.03
docker push katta/openwrt-rootfs:10.03
@ywgf88
Copy link

ywgf88 commented Jun 30, 2019

可能这个要求有点过分,但是我看你这个安装步骤一直搞不明白,能否出个文档或者视频,让我在docker下安装OpenWRT,谢谢!

@il-katta
Copy link
Author

@apetab
Copy link

apetab commented Jul 8, 2019

Running on centos 7, cpu 100%

@il-katta
Copy link
Author

Running on centos 7, cpu 100%

you ran the docker or the script ?

@d9394
Copy link

d9394 commented Dec 18, 2019

Step 3/5 : RUN mkdir -p /var/lock && mkdir -p /var/run && opkg update && opkg install luci luci-ssl luci-theme-openwrt && rm /var/opkg-lists/* && /etc/init.d/dropbear enable
---> Running in 9f4f89b51a1a
/bin/sh: can't load library 'libcrypt.so.0'
The command '/bin/sh -c mkdir -p /var/lock && mkdir -p /var/run && opkg update && opkg install luci luci-ssl luci-theme-openwrt && rm /var/opkg-lists/* && /etc/init.d/dropbear enable' returned a non-zero code: 16

Where did the libcrypt.so.0 location?

@il-katta
Copy link
Author

il-katta commented Jan 3, 2020

Step 3/5 : RUN mkdir -p /var/lock && mkdir -p /var/run && opkg update && opkg install luci luci-ssl luci-theme-openwrt && rm /var/opkg-lists/* && /etc/init.d/dropbear enable
---> Running in 9f4f89b51a1a
/bin/sh: can't load library 'libcrypt.so.0'
The command '/bin/sh -c mkdir -p /var/lock && mkdir -p /var/run && opkg update && opkg install luci luci-ssl luci-theme-openwrt && rm /var/opkg-lists/* && /etc/init.d/dropbear enable' returned a non-zero code: 16

Where did the libcrypt.so.0 location?

using which tag?

@tomdavidson
Copy link

katta/openwrt-rootfs:19.07.3

/etc/preinit: line 6: can't create /sys/devices/system/cpu/microcode/reload: Read-only file system
ip: RTNETLINK answers: Operation not permitted
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level

ip: can't send flush request: Operation not permitted
ip: SIOCSIFFLAGS: Operation not permitted

@xuhuanxxx
Copy link

katta/openwrt-rootfs:19.07.3

/etc/preinit: line 6: can't create /sys/devices/system/cpu/microcode/reload: Read-only file system
ip: RTNETLINK answers: Operation not permitted
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level

ip: can't send flush request: Operation not permitted
ip: SIOCSIFFLAGS: Operation not permitted

docker run -d --name=openwrt --privileged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment