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

View File

@ -2,20 +2,8 @@
# #
# docker build --rm=true -t plugins/drone-docker . # docker build --rm=true -t plugins/drone-docker .
FROM ubuntu:14.04 FROM rancher/docker
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/*
ADD drone-docker /go/bin/ ADD drone-docker /go/bin/
ADD wrapdocker /bin/
VOLUME /var/lib/docker
ENTRYPOINT ["/go/bin/drone-docker"] ENTRYPOINT ["/go/bin/drone-docker"]

21
main.go
View File

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