
pls ignore this mail Thanks, Luan Shengde On Fri, Feb 11, 2022 at 05:05:52PM +0800, Luan Shengde wrote:
Signed-off-by: Luan Shengde <shdluan@163.com> --- .../todo/20220216-5d:docker-improvement.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 people/LuanShengde/todo/20220216-5d:docker-improvement.md
diff --git a/people/LuanShengde/todo/20220216-5d:docker-improvement.md b/people/LuanShengde/todo/20220216-5d:docker-improvement.md new file mode 100644 index 00000000..416c749d --- /dev/null +++ b/people/LuanShengde/todo/20220216-5d:docker-improvement.md @@ -0,0 +1,35 @@ +# docker improvement + +## handle download failure and check dir besides /lkp and /opt + +original: + curl_cmd: %x(curl -sS --create-dirs -o #{path}/#{name} #{url} && gzip -dc #{path}/#{name} | cpio -idu -D #{path}) + download cgz file and unpack it in one line + +improvement: + curl_cmd: split download cgz file, check dir and unpack the cgz file into standalone lines. + system('wget -t 3 -T 20 -O #{path}/#{name} #{url} 2> /dev/null') + use system to call the linux command, it will retusn true/false + - true: execute success + - false: execute in failure + raise error if download in failure + + %x(gzip -dc path/cgz_file | cpio -idt) + use %x(command) can get the output of the command, extract the file list of the cgz file + check files from the file list and check if the file/dir is besides the /lkp or /opt + + if no files/dirs besides /lkp or /opt + %x(gzip -dc path/cgz_file | cpio -idu -D path) + + if exist files/dirs besides /lkp or /opt + save the cgz to opt + unpack the cgz file in container + + --- + maybe can ignore check the cgz file if it containers files/dirs besides /lkp or /opt + just unpack all the cgz file in the container + --- + +## /usr/local/bin/busybox should be ro + +## cancel mount unnecessary dir -- 2.23.0