first attempt at rancher/docker

This commit is contained in:
Brad Rydzewski 2015-09-04 00:28:10 -07:00
parent 678550e68f
commit d29a26fa53
2 changed files with 13 additions and 22 deletions

@ -2,20 +2,8 @@
#
# docker build --rm=true -t plugins/drone-docker .
FROM ubuntu:14.04
RUN apt-get update -qq \
&& apt-get -y install curl \
apt-transport-https \
ca-certificates \
curl \
lxc \
iptables \
&& curl -sSL https://get.docker.com/ubuntu/ | sh \
&& rm -rf /var/lib/apt/lists/*
FROM rancher/docker
ADD drone-docker /go/bin/
ADD wrapdocker /bin/
VOLUME /var/lib/docker
ENTRYPOINT ["/go/bin/drone-docker"]

17
main.go

@ -51,12 +51,8 @@ func main() {
// Starts the Docker daemon
go func() {
cmd := exec.Command("/bin/bash", "/bin/wrapdocker")
cmd.Stdout = ioutil.Discard
cmd.Stderr = ioutil.Discard
cmd.Run()
args := []string{"daemon", "-s", vargs.Storage}
args := []string{"/usr/bin/docker", "-d", "-s", vargs.Storage}
if vargs.Insecure && len(vargs.Registry) != 0 {
args = append(args, "--insecure-registry", vargs.Registry)
@ -66,15 +62,22 @@ func main() {
args = append(args, "--dns", value)
}
cmd = exec.Command("docker", args...)
cmd := exec.Command("/usr/bin/dockerlaunch", args...)
if os.Getenv("DOCKER_LAUNCH_DEBUG") == "true" {
cmd.Env = os.Environ()
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
} else {
cmd.Stdout = ioutil.Discard
cmd.Stderr = ioutil.Discard
}
trace(cmd)
cmd.Run()
}()
// Sleep for a few seconds
time.Sleep(5 * time.Second)
time.Sleep(35 * time.Second)
// Set the Registry value
if len(vargs.Registry) == 0 {