1
0
mirror of https://github.com/rancher/os.git synced 2025-07-15 23:55:51 +00:00

Merge pull request #674 from imikushin/docker-1.9.1

update to docker-1.9.1 and docker-from-scratch-1.9.1
This commit is contained in:
Ivan Mikushin 2015-12-02 20:57:48 +05:00
commit 94d4114172
30 changed files with 38 additions and 3646 deletions

4
Godeps/Godeps.json generated
View File

@ -363,8 +363,8 @@
},
{
"ImportPath": "github.com/rancher/docker-from-scratch",
"Comment": "v1.9.1-rc1",
"Rev": "29561830fcace9eef5dbbfc4008474e5425d34eb"
"Comment": "v1.9.1",
"Rev": "b7bf6fe5ceafa78b02679ac0d00bf6a5ffbb6194"
},
{
"ImportPath": "github.com/rancher/netconf",

View File

@ -5,4 +5,4 @@ COPY build/dockerlaunch /usr/bin/
COPY build/docker /usr/bin/docker
VOLUME /var/lib/docker
ENTRYPOINT ["/usr/bin/dockerlaunch", "/usr/bin/docker"]
CMD ["-d", "-s", "overlay"]
CMD ["daemon", "-s", "overlay"]

View File

@ -1,55 +0,0 @@
{
"ImportPath": "github.com/rancher/docker-from-scratch",
"GoVersion": "go1.4.1",
"Packages": [
"./..."
],
"Deps": [
{
"ImportPath": "github.com/Sirupsen/logrus",
"Comment": "v0.8.4",
"Rev": "3cb248e9df77413d58a6330dde84236d04c197d5"
},
{
"ImportPath": "github.com/docker/docker/pkg/ioutils",
"Comment": "v1.4.1-4890-ga3857cc",
"Rev": "a3857cc3799e2a92b92f07842c03b442490f01ab"
},
{
"ImportPath": "github.com/docker/docker/pkg/mount",
"Comment": "v1.4.1-4890-ga3857cc",
"Rev": "a3857cc3799e2a92b92f07842c03b442490f01ab"
},
{
"ImportPath": "github.com/docker/libnetwork/resolvconf",
"Comment": "v0.2-299-gf1c5671",
"Rev": "f1c5671f1ee2133055144e566cd8b3a0ae4f0433"
},
{
"ImportPath": "github.com/j-keck/arping",
"Rev": "4f4d2c8983a18e2c9c63a3f339bc9a998c4557bc"
},
{
"ImportPath": "github.com/rancher/netconf",
"Rev": "7dbbacc56c018f16f9123d5ea8cee6e174d44c8b"
},
{
"ImportPath": "github.com/ryanuber/go-glob",
"Rev": "0067a9abd927e50aed5190662702f81231413ae0"
},
{
"ImportPath": "github.com/stretchr/testify/assert",
"Comment": "v1.0-17-g089c718",
"Rev": "089c7181b8c728499929ff09b62d3fdd8df8adff"
},
{
"ImportPath": "github.com/stretchr/testify/require",
"Comment": "v1.0-17-g089c718",
"Rev": "089c7181b8c728499929ff09b62d3fdd8df8adff"
},
{
"ImportPath": "github.com/vishvananda/netlink",
"Rev": "ea0402b9dbdee2126f48508a441835ddcabc7d1e"
}
]
}

View File

@ -1,5 +0,0 @@
This directory tree is generated automatically by godep.
Please do not edit.
See https://github.com/tools/godep for more information.

View File

@ -18,7 +18,7 @@ docker exec -it daemon docker ps
```bash
# Daemon
docker run --name daemon --privileged -d rancher/docker -d -s aufs
docker run --name daemon --privileged -d rancher/docker daemon -s aufs
# Client
docker exec -it daemon docker ps
@ -37,7 +37,7 @@ FROM ubuntu
ADD files.tar /
ENTRYPOINT ["/usr/bin/dockerlaunch", "/usr/bin/docker"]
VOLUME /var/lib/docker
CMD ["-d", "-s", "overlay"]
CMD ["daemon", "-s", "overlay"]
EOF

View File

@ -1,5 +0,0 @@
build
dist
.buildroot-ccache
.kernel-ccache
.dl

View File

@ -1,5 +0,0 @@
FROM ubuntu:14.04.2
COPY ./scripts/bootstrap /scripts/
RUN ./scripts/bootstrap
COPY ./scripts/ /source/scripts/
COPY ./config/ /source/config/

View File

@ -1,24 +0,0 @@
#!/bin/bash
set -e
cd $(dirname $0)
IMAGE=${IMAGE:-dockerscratch-files}
docker build -t $IMAGE .
if [ -z "$NO_BIND" ] && [ "$(uname)" == "Linux" ]; then
mkdir -p cache
ARGS="-v $(pwd):/source -u $(id -u) -e HOME=/root -v $(pwd)/cache:/root"
fi
ID=$(docker run -itd $ARGS $IMAGE /source/scripts/build)
trap "docker rm -fv $ID" exit
docker attach $ID
docker wait $ID
mkdir -p dist
docker cp $ID:/source/dist/base-files.tar.gz dist
echo Done

View File

@ -1,8 +0,0 @@
#!/bin/bash
set -e
set -x
cd $(dirname $0)/..
apt-get update
apt-get install -y build-essential wget libncurses5-dev unzip bc curl python rsync ccache

View File

@ -1,8 +0,0 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
./scripts/download
./scripts/build-busybox-static
./scripts/package

View File

@ -1,49 +0,0 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
: ${ARTIFACTS:=$(pwd)/assets}
: ${BUILD:=$(pwd)/build}
: ${CONFIG:=$(pwd)/config}
: ${DIST:=$(pwd)/dist}
mkdir -p ${BUILD} ${DIST}
busybox_install()
{
local conf=$1
local bbconf=$2
local target=$3
if [ "$#" = "2" ]; then
target=$2
bbconf=
fi
cd ${BUILD}
local buildroot=$(ls -1 ${ARTIFACTS}/buildroot-*.tar.bz2)
if [ ! -e "${buildroot}" ]; then
echo "Failed to find busybox archive, found : ${buildroot}" 1>&2
return 1
else
buildroot=$(basename $buildroot)
fi
if [ ! -e ${buildroot/.tar.bz2//} ]; then
tar xvjf ${ARTIFACTS}/${buildroot}
fi
cd ${buildroot/.tar.bz2//}
cp $conf .config
if [ -n "$bbconf" ]; then
cp $bbconf package/busybox/
fi
make oldconfig
make
}
busybox_install ${CONFIG}/buildroot-config-static ${CONFIG}/busybox-ps-modprobe-only.config ${DIST}/rootfs-static.tar

View File

@ -1,5 +0,0 @@
#!/bin/bash
cd $(dirname $0)/..
rm -rf build dist

View File

@ -1,41 +0,0 @@
#!/bin/bash
set -e
set -x
cd $(dirname $0)/..
: ${ARTIFACTS:=$(pwd)/assets}
check()
{
local hash=$1
local file=$2
if [ ! -e "$file" ]; then
return 1
fi
CURRENT=$(sha1sum $file | awk '{print $1}')
[ "$hash" = "$CURRENT" ]
}
download()
{
mkdir -p ${ARTIFACTS}
local url=$2
local file=${ARTIFACTS}/$(basename $2)
local hash=$1
if ! check $hash $file; then
curl -sL $url > $file
fi
if ! check $hash $file; then
echo "ERROR: $file does not match checksum $hash, got $CURRENT" 1>&2
return 1
fi
}
download 8efabafe68d21616c7f2ac9fdad8427fc94a015d http://buildroot.uclibc.org/downloads/buildroot-2015.05.tar.bz2

View File

@ -1,34 +0,0 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
rm -rf build/stage
mkdir -p build/stage
mkdir -p dist
pushd build/stage
BASE=$(echo ../buildroot-*/output/target/)
mkdir -p usr/bin usr/share usr/libexec/git-core
cp $BASE/bin/busybox usr/bin
cp $BASE/usr/bin/xz usr/bin
cp $BASE/usr/bin/git usr/bin
cp $BASE/usr/bin/ssh usr/bin
cp $BASE/usr/sbin/xtables-multi usr/bin/iptables
cp -rf $BASE/usr/share/git-core usr/share
ln -s ../../bin/git usr/libexec/git-core/git-clone
ln -s ../../bin/git usr/libexec/git-core/git-checkout
ln -s bin usr/sbin
# Okay, this is a hack. I won't tell anyone if you don't.
# Honestly, who uses git submodules anyways...
echo '#!/usr/bin/busybox echo' > usr/libexec/git-core/git-submodule
chmod +x usr/libexec/git-core/git-submodule
ln -s busybox usr/bin/ps
ln -s busybox usr/bin/modprobe
tar cvzf ../../dist/base-files.tar.gz .

View File

@ -1,37 +0,0 @@
package main
import (
"os"
log "github.com/Sirupsen/logrus"
dockerlaunch "github.com/rancher/docker-from-scratch"
)
func main() {
Main()
}
func Main() {
if os.Getenv("DOCKER_LAUNCH_DEBUG") == "true" {
log.SetLevel(log.DebugLevel)
}
if len(os.Args) < 2 {
log.Fatalf("Usage Example: %s /usr/bin/docker -d -D", os.Args[0])
}
args := []string{}
if len(os.Args) > 1 {
args = os.Args[2:]
}
var config dockerlaunch.Config
args = dockerlaunch.ParseConfig(&config, args...)
log.Debugf("Launch config %#v", config)
_, err := dockerlaunch.LaunchDocker(&config, os.Args[1], args...)
if err != nil {
log.Fatal(err)
}
}

View File

@ -547,3 +547,28 @@ func LaunchDocker(config *Config, docker string, args ...string) (*exec.Cmd, err
return runOrExec(config, docker, args...)
}
func Main() {
if os.Getenv("DOCKER_LAUNCH_DEBUG") == "true" {
log.SetLevel(log.DebugLevel)
}
if len(os.Args) < 2 {
log.Fatalf("Usage Example: %s /usr/bin/docker -d -D", os.Args[0])
}
args := []string{}
if len(os.Args) > 1 {
args = os.Args[2:]
}
var config Config
args = ParseConfig(&config, args...)
log.Debugf("Launch config %#v", config)
_, err := LaunchDocker(&config, os.Args[1], args...)
if err != nil {
log.Fatal(err)
}
}

View File

@ -1,12 +0,0 @@
FROM golang:1.4.3-cross
RUN go get github.com/mitchellh/gox
RUN go get github.com/tools/godep
ENV GOPATH /go/src/github.com/rancher/docker-from-scratch/Godeps/_workspace:/go
WORKDIR /go/src/github.com/rancher/docker-from-scratch
COPY . .
RUN godep go build -ldflags "-linkmode external -extldflags -static" -o build/dockerlaunch ./main

View File

@ -1,22 +0,0 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
mkdir -p build
if [ ! -e build/ca-certificates.crt ]; then
ID=$(docker run -d ubuntu sh -c "apt-get update && apt-get install -y ca-certificates")
docker logs -f ${ID} &
docker wait ${ID}
docker cp ${ID}:/etc/ssl/certs/ca-certificates.crt build/
docker rm -vf ${ID} || true
fi
docker build -f ./scripts/Dockerfile.build -t dockerscratch-build .
ID=$(docker run -d dockerscratch-build strip --strip-all build/dockerlaunch)
trap "docker rm -fv ${ID}" EXIT
docker logs -f ${ID} &
docker wait ${ID}
docker cp ${ID}:/go/src/github.com/rancher/docker-from-scratch/build/dockerlaunch ./build/

View File

@ -1,14 +0,0 @@
#!/bin/bash
set -e
cd $(dirname $0)
docker ps >/dev/null 2>&1 || wrapdocker 2>/dev/null || true
./download
./build
./package
if [ -z "$NO_TEST" ]; then
./test
fi

View File

@ -1,2 +0,0 @@
VERSION=$(<./scripts/version)
IMAGE=${IMAGE:-rancher/docker:${VERSION}}

View File

@ -1,53 +0,0 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
: ${ARTIFACTS:=$(pwd)/assets}
: ${BUILD:=$(pwd)/build}
check()
{
local hash=$1
local file=$2
if [ ! -e "$file" ]; then
return 1
fi
CURRENT=$(shasum -a 1 $file | awk '{print $1}')
[ "$hash" = "$CURRENT" ]
}
download()
{
mkdir -p ${ARTIFACTS}
local url=$2
local file=${ARTIFACTS}/$(basename $2)
local hash=$1
if ! check $hash $file; then
curl -sL $url > $file
fi
if ! check $hash $file; then
echo "ERROR: $file does not match checksum $hash, got $CURRENT" 1>&2
return 1
fi
}
mkdir -p ${BUILD}
if [ -e base-image/dist/base-files.tar.gz ]; then
cp base-image/dist/base-files.tar.gz build/
else
download 920a7e413c34bf94928c3e6c8aad1dcca9bd0128 https://github.com/rancher/docker-from-scratch/releases/download/bin-v0.2.0/base-files.tar.gz
cp assets/base-files.tar.gz build
fi
download 9da1e4d4cac3b117bb0cd7da66201fe1fc9953ab https://test.docker.com/builds/Linux/x86_64/docker-1.9.1-rc1
cp assets/docker-* build/docker
chmod +x build/docker

View File

@ -1,10 +0,0 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
. ./scripts/common
docker build -t $IMAGE -f Dockerfile .
echo Built $IMAGE

View File

@ -1,15 +0,0 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
. ./scripts/common
mkdir -p build/test-cache
ID=$(docker run -d --privileged -e DOCKER_LAUNCH_DEBUG=true -v /lib/modules/$(uname -r):/lib/modules/$(uname -r) $IMAGE -d -s $(docker info | grep 'Storage Driver' | cut -f2 -d:))
docker logs -f $ID &
trap "docker rm -fv $ID" EXIT
docker exec -i $ID docker build -t test-build git://github.com/rancher/tiny-build.git
docker exec -i $ID docker version
docker exec -i $ID docker info
docker exec -i $ID docker run test-build

View File

@ -1 +0,0 @@
1.9.1-rc1

View File

@ -1,6 +1,6 @@
IMAGE_NAME=rancher/os
VERSION=v0.4.2-dev
DOCKER_BINARY_URL=https://github.com/rancher/docker/releases/download/v1.9.1-rc1-ros1/docker-1.9.1-rc1
DOCKER_BINARY_URL=https://github.com/rancher/docker/releases/download/v1.9.1-ros1/docker-1.9.1
COMPILED_KERNEL_URL=https://github.com/rancher/os-kernel/releases/download/Ubuntu-4.2.0-16.19/linux-4.2.3-rancher-x86.tar.gz
DFS_IMAGE=rancher/docker:1.9.1-rc1
DFS_IMAGE=rancher/docker:1.9.1

View File

@ -6,7 +6,7 @@ import (
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/reexec"
dockerlaunchMain "github.com/rancher/docker-from-scratch/main"
"github.com/rancher/docker-from-scratch"
"github.com/rancher/os/cmd/cloudinit"
"github.com/rancher/os/cmd/control"
"github.com/rancher/os/cmd/network"
@ -42,7 +42,7 @@ func registerCmd(cmd string, mainFunc func()) {
func main() {
registerCmd("/init", osInit.MainInit)
registerCmd(config.SYSINIT_BIN, sysinit.Main)
registerCmd("/usr/bin/dockerlaunch", dockerlaunchMain.Main)
registerCmd("/usr/bin/dockerlaunch", dockerlaunch.Main)
registerCmd("/usr/bin/user-docker", userdocker.Main)
registerCmd("/usr/bin/system-docker", systemdocker.Main)
registerCmd("/sbin/poweroff", power.PowerOff)

View File

@ -61,5 +61,9 @@ def run_qemu(request, run_args=[]):
@pytest.mark.timeout(10)
def wait_for_ssh(ssh_command=['./scripts/ssh', '--qemu']):
i = 0
print('\nWaiting for ssh and docker... ' + str(i))
while subprocess.call(ssh_command + ['docker version >/dev/null 2>&1']) != 0:
i += 1
print('\nWaiting for ssh and docker... ' + str(i))
time.sleep(1)