Sign inSign up

dafu/busybox

By dafu

•Updated almost 11 years ago

自造原生 Busybox image

Image
0

1.5K

dafu/busybox repository overview

  1. 建立 dafu/busybox image 的程序檔 bigred@US140464:~/mybusybox$ cat mkimage-busybox.sh #!/usr/bin/env bash

⁠Generate a very minimal filesystem based on busybox-static,

⁠and load it into the local docker under the name "busybox".

BUSYBOX=$(which busybox) [ "$BUSYBOX" ] || { echo "Sorry, I could not locate busybox." echo "Try 'apt-get install busybox-static'?" exit 1 }

set -e ROOTFS=${TMPDIR:-/var/tmp}/rootfs-busybox-$$-$RANDOM mkdir $ROOTFS cd $ROOTFS

mkdir bin etc dev dev/pts lib proc sys tmp touch etc/resolv.conf cp /etc/nsswitch.conf etc/nsswitch.conf echo root:x:0:0:root:/:/bin/sh > etc/passwd echo root:x:0: > etc/group ln -s lib lib64 ln -s bin sbin cp $BUSYBOX bin for X in $(busybox --list) do ln -s busybox bin/$X done rm bin/init ln bin/busybox bin/init cp /lib/x86_64-linux-gnu/lib{pthread,c,dl,nsl,nss_}.so. lib cp /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 lib for X in console null ptmx random stdin stdout stderr tty urandom zero do cp -a /dev/$X dev done

mkdir www echo "#!/bin/sh" > bin/httpd.sh echo "httpd -p 80 -h /www" >> bin/httpd.sh echo "/bin/sh" >> bin/httpd.sh chmod +x bin/httpd.sh

tar --numeric-owner -cf- . | docker import - dafu/busybox

  1. 以交談模式, 啟動 HTTPD, 命令如下 : $ sudo docker run --name myhttpd -i -t dafu/busybox httpd.sh

  2. 以背景模式, 啟動 HTTPD, 命令如下 : $ sudo docker run --name myhttpd -i -d -t dafu/busybox httpd.sh

Tag summary

Content type

Image

Digest

sha256:ff99ec4aa…

Size

1.9 MB

Last updated

almost 11 years ago

docker pull dafu/busybox