From 5a4f4d5ee70a7688dd1c62309023fc06209a8a45 Mon Sep 17 00:00:00 2001 From: jpetazzo Date: Thu, 14 Mar 2013 03:16:42 +0000 Subject: [PATCH 1/2] Add contrib/ directory, README, and script to create a basic busybox image Upstream-commit: c74408d7b8e70c67e411bc21a31b98cbf5480a47 Component: engine --- components/engine/contrib/README | 4 ++ components/engine/contrib/mkimage-busybox.sh | 40 ++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 components/engine/contrib/README create mode 100755 components/engine/contrib/mkimage-busybox.sh diff --git a/components/engine/contrib/README b/components/engine/contrib/README new file mode 100644 index 0000000000..92b1d94433 --- /dev/null +++ b/components/engine/contrib/README @@ -0,0 +1,4 @@ +The `contrib` directory contains scripts, images, and other helpful things +which are not part of the core docker distribution. Please note that they +could be out of date, since they do not receive the same attention as the +rest of the repository. diff --git a/components/engine/contrib/mkimage-busybox.sh b/components/engine/contrib/mkimage-busybox.sh new file mode 100755 index 0000000000..6c091d2c4a --- /dev/null +++ b/components/engine/contrib/mkimage-busybox.sh @@ -0,0 +1,40 @@ +#!/bin/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=/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 + +tar -cf- . | docker put busybox +docker run -i -a -u root busybox /bin/echo Success. + From d56aa1816f4015f44107c77208a587e11e3a99a9 Mon Sep 17 00:00:00 2001 From: jpetazzo Date: Thu, 14 Mar 2013 03:26:50 +0000 Subject: [PATCH 2/2] Update get.docker.io install script for single-binary Upstream-commit: e81d7132faf0e9e9e12b24733e1bdc452eb81525 Component: engine --- components/engine/{ => contrib}/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename components/engine/{ => contrib}/install.sh (94%) mode change 100644 => 100755 diff --git a/components/engine/install.sh b/components/engine/contrib/install.sh old mode 100644 new mode 100755 similarity index 94% rename from components/engine/install.sh rename to components/engine/contrib/install.sh index 0cfba4ddc3..b0a998332e --- a/components/engine/install.sh +++ b/components/engine/contrib/install.sh @@ -38,14 +38,14 @@ fi echo "Downloading docker binary and uncompressing into /usr/local/bin..." curl -s http://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-master.tgz | tar -C /usr/local/bin --strip-components=1 -zxf- \ -docker-master/docker docker-master/dockerd +docker-master/docker if [ -f /etc/init/dockerd.conf ] then echo "Upstart script already exists." else echo "Creating /etc/init/dockerd.conf..." - echo "exec /usr/local/bin/dockerd" > /etc/init/dockerd.conf + echo "exec /usr/local/bin/docker -d" > /etc/init/dockerd.conf fi echo "Starting dockerd..."