From cea6d4e302816786db557a92b0b35ecdbb22b04a Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 22 Aug 2018 23:11:53 +0000 Subject: [PATCH 1/6] Make GO_IMAGE configurable, default to official go Signed-off-by: Eli Uriegas (cherry picked from commit 4cdbe08bf929d5c731b61e1cea217fa40156a3a8) Signed-off-by: Eli Uriegas Upstream-commit: 5bfb6ce9464fea13abc71fb6c12b9f5cb01a29a4 Component: packaging --- components/packaging/image/Dockerfile.engine | 24 ++++++++++++++------ components/packaging/image/Makefile | 6 ++++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/components/packaging/image/Dockerfile.engine b/components/packaging/image/Dockerfile.engine index d393faf7f1..b13edb552f 100644 --- a/components/packaging/image/Dockerfile.engine +++ b/components/packaging/image/Dockerfile.engine @@ -1,13 +1,23 @@ # Common builder -FROM golang:1.10-alpine3.7 as builder - -#COPY hack/dockerfile/binaries-commits / +ARG GO_IMAGE +FROM ${GO_IMAGE} as builder COPY hack/dockerfile/install/tini.installer / COPY hack/dockerfile/install/proxy.installer / -RUN apk --update add bash btrfs-progs-dev gcc libc-dev linux-headers \ - git cmake make ca-certificates libltdl libtool libgcc && \ - grep "_COMMIT=" /*.installer |cut -f2- -d: > /binaries-commits +RUN apt-get update && apt-get install -y \ + bash \ + btrfs-progs-dev \ + ca-certificates \ + cmake \ + gcc \ + git \ + libc-dev \ + libgcc \ + libltdl \ + libtool \ + linux-headers \ + make +RUN grep "_COMMIT=" /*.installer |cut -f2- -d: > /binaries-commits # dockerd FROM builder as dockerd-builder @@ -39,7 +49,7 @@ RUN git clone https://github.com/docker/libnetwork.git /go/src/github.com/docker WORKDIR /go/src/github.com/docker/libnetwork RUN source /binaries-commits && \ git checkout -q "$LIBNETWORK_COMMIT" && \ - go build -buildmode=pie -ldflags="$PROXY_LDFLAGS" \ + CGO_ENABLED=0 go build -buildmode=pie -ldflags="$PROXY_LDFLAGS" \ -o /sbin/docker-proxy \ github.com/docker/libnetwork/cmd/proxy diff --git a/components/packaging/image/Makefile b/components/packaging/image/Makefile index 7718ef11b6..89d4135ec1 100644 --- a/components/packaging/image/Makefile +++ b/components/packaging/image/Makefile @@ -2,6 +2,9 @@ SHELL:=/bin/bash ENGINE_DIR:=$(CURDIR)/../../engine CLI_DIR:=$(CURDIR)/../../cli VERSION?=0.0.0-dev +GO_BASE_IMAGE=golang +GO_VERSION:=1.10.3 +GO_IMAGE=$(GO_BASE_IMAGE):$(GO_VERSION) STATIC_VERSION=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION)) DOCKER_HUB_ORG?=dockereng ARCH=$(shell uname -m) @@ -24,10 +27,11 @@ image: image-linux $(ENGINE_DIR)/Dockerfile.engine: cp Dockerfile.engine $(ENGINE_DIR) -# builds across multiple archs because the base images +# builds across multiple archs because the base images # utilize manifests image-linux: $(ENGINE_DIR)/Dockerfile.engine docker build -t $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) \ + --build-arg GO_IMAGE="$(GO_IMAGE)" \ --build-arg VERSION="$(STATIC_VERSION)" \ --build-arg GITCOMMIT="$$(cd $(ENGINE_DIR) && git rev-parse --short=7 HEAD)" \ --build-arg BUILDTIME="$(BUILDTIME)" \ From adca33ea9c59f0a949017ec88db566ffd0fe0644 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 22 Aug 2018 23:24:19 +0000 Subject: [PATCH 2/6] Fix whitespace, add Dockerfile.engine to clean Signed-off-by: Eli Uriegas (cherry picked from commit 831482a3296e9a7b1ad10f6b8c850a7a4095b881) Signed-off-by: Eli Uriegas Upstream-commit: ce1d295cf4f7049dc48813d825511a85ebf7e9c1 Component: packaging --- components/packaging/image/Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/components/packaging/image/Makefile b/components/packaging/image/Makefile index 89d4135ec1..9435288ad5 100644 --- a/components/packaging/image/Makefile +++ b/components/packaging/image/Makefile @@ -17,6 +17,7 @@ help: ## show make targets .PHONY: clean clean: ## remove build artifacts + -$(RM) $(ENGINE_DIR)/Dockerfile.engine -docker rmi $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION) -rm -f image-linux @@ -32,13 +33,13 @@ $(ENGINE_DIR)/Dockerfile.engine: image-linux: $(ENGINE_DIR)/Dockerfile.engine docker build -t $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) \ --build-arg GO_IMAGE="$(GO_IMAGE)" \ - --build-arg VERSION="$(STATIC_VERSION)" \ - --build-arg GITCOMMIT="$$(cd $(ENGINE_DIR) && git rev-parse --short=7 HEAD)" \ - --build-arg BUILDTIME="$(BUILDTIME)" \ - --build-arg PLATFORM="$(PLATFORM)" \ - --build-arg PRODUCT="$(PRODUCT)" \ - --build-arg DEFAULT_PRODUCT_LICENSE="$(DEFAULT_PRODUCT_LICENSE)" \ - --file $< $(ENGINE_DIR) + --build-arg VERSION="$(STATIC_VERSION)" \ + --build-arg GITCOMMIT="$$(cd $(ENGINE_DIR) && git rev-parse --short=7 HEAD)" \ + --build-arg BUILDTIME="$(BUILDTIME)" \ + --build-arg PLATFORM="$(PLATFORM)" \ + --build-arg PRODUCT="$(PRODUCT)" \ + --build-arg DEFAULT_PRODUCT_LICENSE="$(DEFAULT_PRODUCT_LICENSE)" \ + --file $< $(ENGINE_DIR) echo $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) > $@ engine-$(ARCH).tar: image-linux From 45b43d2050d837e34f0d9f3b114c417cdb82c33a Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 22 Aug 2018 23:24:42 +0000 Subject: [PATCH 3/6] Wire up dependencies for debian, source -> . Signed-off-by: Eli Uriegas (cherry picked from commit 99bbb6e33f46b6e2621204aac3b05344783ccfaa) Signed-off-by: Eli Uriegas Upstream-commit: 3aeb8e9365fefea1be6e6b64624fccb81d5a70ad Component: packaging --- components/packaging/image/Dockerfile.engine | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/packaging/image/Dockerfile.engine b/components/packaging/image/Dockerfile.engine index b13edb552f..ec6c94d074 100644 --- a/components/packaging/image/Dockerfile.engine +++ b/components/packaging/image/Dockerfile.engine @@ -6,16 +6,16 @@ COPY hack/dockerfile/install/tini.installer / COPY hack/dockerfile/install/proxy.installer / RUN apt-get update && apt-get install -y \ bash \ - btrfs-progs-dev \ + btrfs-tools \ ca-certificates \ cmake \ gcc \ git \ libc-dev \ - libgcc \ - libltdl \ + libgcc-6-dev \ + libltdl-dev \ libtool \ - linux-headers \ + linux-headers-$(dpkg --print-architecture) \ make RUN grep "_COMMIT=" /*.installer |cut -f2- -d: > /binaries-commits @@ -47,7 +47,7 @@ RUN go build -o /sbin/dockerd \ FROM builder as proxy-builder RUN git clone https://github.com/docker/libnetwork.git /go/src/github.com/docker/libnetwork WORKDIR /go/src/github.com/docker/libnetwork -RUN source /binaries-commits && \ +RUN . /binaries-commits && \ git checkout -q "$LIBNETWORK_COMMIT" && \ CGO_ENABLED=0 go build -buildmode=pie -ldflags="$PROXY_LDFLAGS" \ -o /sbin/docker-proxy \ @@ -57,17 +57,17 @@ RUN source /binaries-commits && \ FROM builder as init-builder RUN git clone https://github.com/krallin/tini.git /tini WORKDIR /tini -RUN source /binaries-commits && \ +RUN . /binaries-commits && \ git checkout -q "$TINI_COMMIT" && \ cmake . && make tini-static && \ cp tini-static /sbin/docker-init # runc FROM builder as runc-builder -RUN apk --update add libseccomp-dev +RUN apt-get install -y libseccomp-dev RUN git clone https://github.com/opencontainers/runc.git /go/src/github.com/opencontainers/runc WORKDIR /go/src/github.com/opencontainers/runc -RUN source /binaries-commits && \ +RUN . /binaries-commits && \ git checkout -q "$RUNC_COMMIT" && \ make BUILDTAGS='seccomp apparmor' static && make install From 6c6bc2f8c9fdc3a6d0795fcfd790da972559f812 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Thu, 23 Aug 2018 15:08:24 +0000 Subject: [PATCH 4/6] Remove linux-headers as a dependency Signed-off-by: Eli Uriegas Upstream-commit: 82258262f90bfaca3a2ef14e6b53238c2fac3147 Component: packaging --- components/packaging/image/Dockerfile.engine | 1 - 1 file changed, 1 deletion(-) diff --git a/components/packaging/image/Dockerfile.engine b/components/packaging/image/Dockerfile.engine index ec6c94d074..9242dcdc67 100644 --- a/components/packaging/image/Dockerfile.engine +++ b/components/packaging/image/Dockerfile.engine @@ -15,7 +15,6 @@ RUN apt-get update && apt-get install -y \ libgcc-6-dev \ libltdl-dev \ libtool \ - linux-headers-$(dpkg --print-architecture) \ make RUN grep "_COMMIT=" /*.installer |cut -f2- -d: > /binaries-commits From dc460e810c20285d8d0a1e87f3effc4061180b75 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 22 Aug 2018 20:32:44 +0000 Subject: [PATCH 5/6] Remove overlay as the default storage driver Should rely on list in the daemon Signed-off-by: Eli Uriegas (cherry picked from commit 605758124d0750c14d24bfb1ebcf77d102591f4a) Signed-off-by: Eli Uriegas Upstream-commit: 6cc81c2e8c95127baac275750bc544452fec7799 Component: packaging --- components/packaging/common/dockerd.json | 1 - 1 file changed, 1 deletion(-) diff --git a/components/packaging/common/dockerd.json b/components/packaging/common/dockerd.json index e96b9bc37b..a3e714b9c4 100644 --- a/components/packaging/common/dockerd.json +++ b/components/packaging/common/dockerd.json @@ -3,7 +3,6 @@ "imagePath": "/var/lib/docker-engine/engine.tar", "namespace":"docker", "args": [ - "-s", "overlay", "--containerd", "/run/containerd/containerd.sock", "--default-runtime", "containerd", "--add-runtime", "containerd=runc" From 51edf81efbf0c2b88fd5cad41bffae5e090f71e6 Mon Sep 17 00:00:00 2001 From: Andrew Hsu Date: Thu, 23 Aug 2018 06:08:57 +0000 Subject: [PATCH 6/6] use systemctl is-active to check for containerd The other way was not working. Signed-off-by: Andrew Hsu (cherry picked from commit f00df1bf1efa2ed1ea508ea7b1c291500441571d) Signed-off-by: Andrew Hsu Upstream-commit: a9b0387bb0f40bd7687d8653a0714724eb66f3b9 Component: packaging --- components/packaging/containerd.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/packaging/containerd.mk b/components/packaging/containerd.mk index 12bad420f7..2e67b7ba98 100644 --- a/components/packaging/containerd.mk +++ b/components/packaging/containerd.mk @@ -4,7 +4,7 @@ CONTAINERD_PROXY_COMMIT=82ae3d13e91d062dd4853379fe018638023c8da2 CONTAINERD_SHIM_PROCESS_IMAGE=docker.io/docker/containerd-shim-process:ff98a47 # If containerd is running use that socket instead -ifeq ($(shell systemctl status containerd 2>/dev/null >/dev/null && echo -n "yes"), "yes") +ifeq ("$(shell systemctl is-active containerd)", "active") CONTAINERD_SOCK:=/var/run/containerd/containerd.sock else CONTAINERD_SOCK:=/var/run/docker/containerd/docker-containerd.sock