All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v6 0/3] Add docker engine support
@ 2016-05-28 22:46 Christian Stewart
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 1/3] runc: new package Christian Stewart
                   ` (3 more replies)
  0 siblings, 4 replies; 22+ messages in thread
From: Christian Stewart @ 2016-05-28 22:46 UTC (permalink / raw)
  To: buildroot

This series adds runc, docker-containerd, and docker-engine support.

The aufs graph driver is compiled for the docker-engine, but aufs and
other optional graph drivers will work at runtime only if the
corresponding kernel features and userspace tools are installed. This is
left up to the user.

Graph driver selection has been re-enabled as of v6 as btrfs and
overlayfs both require build-time headers from the corresponding utility
packages.

Patch 1 adds runC, the new minimal CLI for running linux containers.
Patch 2 adds docker-containerd, the daemon and API for runC.
Patch 3 adds docker-engine, the cli and api for the Docker application
engine.

Christian Stewart (3):
  runc: new package
  docker-containerd: new package
  docker-engine: new package

 package/Config.in                                |   3 +
 package/docker-containerd/0001-arm64-fixes.patch | 189 +++++++++++++++++++++++
 package/docker-containerd/Config.in              |  13 ++
 package/docker-containerd/docker-containerd.hash |   2 +
 package/docker-containerd/docker-containerd.mk   |  44 ++++++
 package/docker-engine/Config.in                  |  69 +++++++++
 package/docker-engine/docker-engine.hash         |   2 +
 package/docker-engine/docker-engine.mk           |  99 ++++++++++++
 package/runc/Config.in                           |  13 ++
 package/runc/runc.hash                           |   2 +
 package/runc/runc.mk                             |  46 ++++++
 11 files changed, 482 insertions(+)
 create mode 100644 package/docker-containerd/0001-arm64-fixes.patch
 create mode 100644 package/docker-containerd/Config.in
 create mode 100644 package/docker-containerd/docker-containerd.hash
 create mode 100644 package/docker-containerd/docker-containerd.mk
 create mode 100644 package/docker-engine/Config.in
 create mode 100644 package/docker-engine/docker-engine.hash
 create mode 100644 package/docker-engine/docker-engine.mk
 create mode 100644 package/runc/Config.in
 create mode 100644 package/runc/runc.hash
 create mode 100644 package/runc/runc.mk

-- 
2.7.3

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 1/3] runc: new package
  2016-05-28 22:46 [Buildroot] [PATCH v6 0/3] Add docker engine support Christian Stewart
@ 2016-05-28 22:46 ` Christian Stewart
  2016-07-04 16:29   ` Romain Naour
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 2/3] docker-containerd: " Christian Stewart
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 22+ messages in thread
From: Christian Stewart @ 2016-05-28 22:46 UTC (permalink / raw)
  To: buildroot

runC is a CLI tool for spawning and running containers according to the
OCP specification.

runC is used by the latest Docker engine versions, however, runc itself
is standalone and has no other dependencies.

https://runc.io/

Signed-off-by: Christian Stewart <christian@paral.in>

---

Changes since v1:
 - use call github to generate source url
Changes since v3:
 - fix indentation in Config.in
 - add dep on threads in Config.in
 - break gopath into separate variable
 - use HOST_GO_TARGET_ENV
Changes since v4:
 - use RUNC_VERSION instead of commit hash
 - only show comment when build is possible with threads enabled

---
 package/Config.in      |  1 +
 package/runc/Config.in | 13 +++++++++++++
 package/runc/runc.hash |  2 ++
 package/runc/runc.mk   | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 62 insertions(+)
 create mode 100644 package/runc/Config.in
 create mode 100644 package/runc/runc.hash
 create mode 100644 package/runc/runc.mk

diff --git a/package/Config.in b/package/Config.in
index 9d668bf..6c513ba 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1664,6 +1664,7 @@ endif
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/rsyslog/Config.in"
 endif
+	source "package/runc/Config.in"
 	source "package/scrub/Config.in"
 	source "package/scrypt/Config.in"
 	source "package/smack/Config.in"
diff --git a/package/runc/Config.in b/package/runc/Config.in
new file mode 100644
index 0000000..1802e59
--- /dev/null
+++ b/package/runc/Config.in
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_RUNC
+	bool "runc"
+	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	help
+	  runC is a CLI tool for spawning and running containers
+	  according to the OCP specification.
+
+	  https://github.com/opencontainers/runc
+
+comment "runc needs a toolchain w/ threads"
+	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/runc/runc.hash b/package/runc/runc.hash
new file mode 100644
index 0000000..c109c33
--- /dev/null
+++ b/package/runc/runc.hash
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 f9955daed1e73e842b2f28a258fba51f4e72a6b4b64cc3fc06415481d55ce000  runc-v0.1.1.tar.gz
diff --git a/package/runc/runc.mk b/package/runc/runc.mk
new file mode 100644
index 0000000..72b194d
--- /dev/null
+++ b/package/runc/runc.mk
@@ -0,0 +1,46 @@
+################################################################################
+#
+# runc
+#
+################################################################################
+
+RUNC_VERSION = v0.1.1
+RUNC_SITE = $(call github,opencontainers,runc,$(RUNC_VERSION))
+
+RUNC_LICENSE = Apache-2.0
+RUNC_LICENSE_FILES = LICENSE
+
+RUNC_DEPENDENCIES = host-go
+
+RUNC_GOPATH = "$(@D)/Godeps/_workspace"
+RUNC_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
+	CGO_ENABLED=1 \
+	GOBIN="$(@D)/bin" \
+	GOPATH="$(RUNC_GOPATH)"
+
+RUNC_GLDFLAGS = \
+	-X main.gitCommit=$(RUNC_VERSION) \
+	-extldflags '-static'
+
+RUNC_GOTAGS = cgo static_build
+
+ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
+RUNC_GOTAGS += seccomp
+RUNC_DEPENDENCIES += libseccomp
+endif
+
+define RUNC_CONFIGURE_CMDS
+	mkdir -p $(RUNC_GOPATH)/src/github.com/opencontainers
+	ln -s $(@D) $(RUNC_GOPATH)/src/github.com/opencontainers/runc
+endef
+
+define RUNC_BUILD_CMDS
+	cd $(@D) && $(RUNC_MAKE_ENV) $(HOST_DIR)/usr/bin/go \
+		build -v -o $(@D)/bin/runc -tags "$(RUNC_GOTAGS)" -ldflags "$(RUNC_GLDFLAGS)" .
+endef
+
+define RUNC_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/bin/runc $(TARGET_DIR)/usr/bin/runc
+endef
+
+$(eval $(generic-package))
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 2/3] docker-containerd: new package
  2016-05-28 22:46 [Buildroot] [PATCH v6 0/3] Add docker engine support Christian Stewart
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 1/3] runc: new package Christian Stewart
@ 2016-05-28 22:46 ` Christian Stewart
  2016-06-07 20:15   ` Andrew Webster
  2016-07-04 17:43   ` Romain Naour
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 3/3] docker-engine: " Christian Stewart
  2016-06-27 22:22 ` [Buildroot] [PATCH v6 0/3] Add docker engine support Christian Stewart
  3 siblings, 2 replies; 22+ messages in thread
From: Christian Stewart @ 2016-05-28 22:46 UTC (permalink / raw)
  To: buildroot

docker-containerd is a daemon and API for controlling and managing runC
containers.

https://containerd.tools/

Signed-off-by: Christian Stewart <christian@paral.in>

---

Changes since v3:
 - Don't depend on runc at compile-time
 - Add threading dependency
 - Use HOST_GO_TARGET_ENV, partially
 - Cleanup compile commands
 - Include patch to fix arm64 compilation
Changes since v4:
 - Bump to v0.2.2
 - update hash for 0.2.2
 - fix docker-runc simlink
 - use CONTAINERD_VERSION for GitCommit const
 - add go arch supports to config.in comment
 - did runtime tests
 - added signed-off-by to the patch series

---
 package/Config.in                                |   1 +
 package/docker-containerd/0001-arm64-fixes.patch | 189 +++++++++++++++++++++++
 package/docker-containerd/Config.in              |  13 ++
 package/docker-containerd/docker-containerd.hash |   2 +
 package/docker-containerd/docker-containerd.mk   |  44 ++++++
 5 files changed, 249 insertions(+)
 create mode 100644 package/docker-containerd/0001-arm64-fixes.patch
 create mode 100644 package/docker-containerd/Config.in
 create mode 100644 package/docker-containerd/docker-containerd.hash
 create mode 100644 package/docker-containerd/docker-containerd.mk

diff --git a/package/Config.in b/package/Config.in
index 6c513ba..c8365f8 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1631,6 +1631,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/dcron/Config.in"
 	source "package/debianutils/Config.in"
 endif
+	source "package/docker-containerd/Config.in"
 	source "package/cgroupfs-mount/Config.in"
 	source "package/dsp-tools/Config.in"
 	source "package/emlog/Config.in"
diff --git a/package/docker-containerd/0001-arm64-fixes.patch b/package/docker-containerd/0001-arm64-fixes.patch
new file mode 100644
index 0000000..19df02c
--- /dev/null
+++ b/package/docker-containerd/0001-arm64-fixes.patch
@@ -0,0 +1,189 @@
+From f6f54370d154b0ce5f35319d878048d7db8db89c Mon Sep 17 00:00:00 2001
+From: Lei Jitang <leijitang@huawei.com>
+Date: Tue, 5 Apr 2016 23:17:30 -0400
+Subject: [PATCH] arm64 fixes
+
+This commit is a combination of a few cherry-picked commits from the
+current master (0.3.0 candidate) of docker-containerd, which
+specifically address issues under arm64.
+
+move epoll syscall to arch specific to enable containerd run on arm64
+Rename epoll_amd64.go to epoll.go
+Signed-off-by: Lei Jitang <leijitang@huawei.com>
+
+archutils: epoll_aarch64: fix C formatting
+Signed-off-by: Aleksa Sarai <asarai@suse.de>
+
+archutils: fix build on aarch64
+Signed-off-by: Aleksa Sarai <asarai@suse.de>
+
+Use flag for aarch64 EpollCreate1
+Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
+
+Correct build flag for arm64
+Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
+
+Series signature:
+
+Signed-off-by: Christian Stewart <christian@paral.in>
+
+---
+ archutils/epoll.go          | 19 ++++++++++++
+ archutils/epoll_arm64.go    | 70 +++++++++++++++++++++++++++++++++++++++++++++
+ supervisor/monitor_linux.go |  9 +++---
+ 3 files changed, 94 insertions(+), 4 deletions(-)
+ create mode 100644 archutils/epoll.go
+ create mode 100644 archutils/epoll_arm64.go
+
+diff --git a/archutils/epoll.go b/archutils/epoll.go
+new file mode 100644
+index 0000000..c8ade64
+--- /dev/null
++++ b/archutils/epoll.go
+@@ -0,0 +1,19 @@
++// +build linux,!arm64
++
++package archutils
++
++import (
++	"syscall"
++)
++
++func EpollCreate1(flag int) (int, error) {
++	return syscall.EpollCreate1(flag)
++}
++
++func EpollCtl(epfd int, op int, fd int, event *syscall.EpollEvent) error {
++	return syscall.EpollCtl(epfd, op, fd, event)
++}
++
++func EpollWait(epfd int, events []syscall.EpollEvent, msec int) (int, error) {
++	return syscall.EpollWait(epfd, events, msec)
++}
+diff --git a/archutils/epoll_arm64.go b/archutils/epoll_arm64.go
+new file mode 100644
+index 0000000..00abc68
+--- /dev/null
++++ b/archutils/epoll_arm64.go
+@@ -0,0 +1,70 @@
++// +build linux,arm64
++
++package archutils
++
++// #include <sys/epoll.h>
++/*
++int EpollCreate1(int flag) {
++	return epoll_create1(flag);
++}
++
++int EpollCtl(int efd, int op,int sfd, int events, int fd) {
++	struct epoll_event event;
++	event.events = events;
++	event.data.fd = fd;
++
++	return epoll_ctl(efd, op, sfd, &event);
++}
++
++struct event_t {
++	uint32_t events;
++	int fd;
++};
++
++struct epoll_event events[128];
++int run_epoll_wait(int fd, struct event_t *event) {
++	int n, i;
++	n = epoll_wait(fd, events, 128, -1);
++	for (i = 0; i < n; i++) {
++		event[i].events = events[i].events;
++		event[i].fd = events[i].data.fd;
++	}
++	return n;
++}
++*/
++import "C"
++
++import (
++	"fmt"
++	"syscall"
++	"unsafe"
++)
++
++func EpollCreate1(flag int) (int, error) {
++	fd := int(C.EpollCreate1(C.int(flag)))
++	if fd < 0 {
++		return fd, fmt.Errorf("failed to create epoll, errno is %d", fd)
++	}
++	return fd, nil
++}
++
++func EpollCtl(epfd int, op int, fd int, event *syscall.EpollEvent) error {
++	errno := C.EpollCtl(C.int(epfd), C.int(syscall.EPOLL_CTL_ADD), C.int(fd), C.int(event.Events), C.int(event.Fd))
++	if errno < 0 {
++		return fmt.Errorf("Failed to ctl epoll")
++	}
++	return nil
++}
++
++func EpollWait(epfd int, events []syscall.EpollEvent, msec int) (int, error) {
++	var c_events [128]C.struct_event_t
++	n := int(C.run_epoll_wait(C.int(epfd), (*C.struct_event_t)(unsafe.Pointer(&c_events))))
++	if n < 0 {
++		return int(n), fmt.Errorf("Failed to wait epoll")
++	}
++	for i := 0; i < n; i++ {
++		events[i].Fd = int32(c_events[i].fd)
++		events[i].Events = uint32(c_events[i].events)
++	}
++	return int(n), nil
++}
+diff --git a/supervisor/monitor_linux.go b/supervisor/monitor_linux.go
+index adf4ffd..b176585 100644
+--- a/supervisor/monitor_linux.go
++++ b/supervisor/monitor_linux.go
+@@ -5,6 +5,7 @@ import (
+ 	"syscall"
+ 
+ 	"github.com/Sirupsen/logrus"
++	"github.com/docker/containerd/archutils"
+ 	"github.com/docker/containerd/runtime"
+ )
+ 
+@@ -14,7 +15,7 @@ func NewMonitor() (*Monitor, error) {
+ 		exits:     make(chan runtime.Process, 1024),
+ 		ooms:      make(chan string, 1024),
+ 	}
+-	fd, err := syscall.EpollCreate1(0)
++	fd, err := archutils.EpollCreate1(0)
+ 	if err != nil {
+ 		return nil, err
+ 	}
+@@ -47,7 +48,7 @@ func (m *Monitor) Monitor(p runtime.Process) error {
+ 		Fd:     int32(fd),
+ 		Events: syscall.EPOLLHUP,
+ 	}
+-	if err := syscall.EpollCtl(m.epollFd, syscall.EPOLL_CTL_ADD, fd, &event); err != nil {
++	if err := archutils.EpollCtl(m.epollFd, syscall.EPOLL_CTL_ADD, fd, &event); err != nil {
+ 		return err
+ 	}
+ 	EpollFdCounter.Inc(1)
+@@ -67,7 +68,7 @@ func (m *Monitor) MonitorOOM(c runtime.Container) error {
+ 		Fd:     int32(fd),
+ 		Events: syscall.EPOLLHUP | syscall.EPOLLIN,
+ 	}
+-	if err := syscall.EpollCtl(m.epollFd, syscall.EPOLL_CTL_ADD, fd, &event); err != nil {
++	if err := archutils.EpollCtl(m.epollFd, syscall.EPOLL_CTL_ADD, fd, &event); err != nil {
+ 		return err
+ 	}
+ 	EpollFdCounter.Inc(1)
+@@ -82,7 +83,7 @@ func (m *Monitor) Close() error {
+ func (m *Monitor) start() {
+ 	var events [128]syscall.EpollEvent
+ 	for {
+-		n, err := syscall.EpollWait(m.epollFd, events[:], -1)
++		n, err := archutils.EpollWait(m.epollFd, events[:], -1)
+ 		if err != nil {
+ 			if err == syscall.EINTR {
+ 				continue
+-- 
+2.7.3
+
diff --git a/package/docker-containerd/Config.in b/package/docker-containerd/Config.in
new file mode 100644
index 0000000..e76a6a2
--- /dev/null
+++ b/package/docker-containerd/Config.in
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_DOCKER_CONTAINERD
+	bool "docker-containerd"
+	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	select BR2_PACKAGE_RUNC
+	help
+	  containerd is a daemon to control runC.
+
+	  https://github.com/docker/containerd
+
+comment "docker-containerd needs a toolchain w/ threads"
+	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/docker-containerd/docker-containerd.hash b/package/docker-containerd/docker-containerd.hash
new file mode 100644
index 0000000..b98e651
--- /dev/null
+++ b/package/docker-containerd/docker-containerd.hash
@@ -0,0 +1,2 @@
+# Computed locally
+sha256 a21efc7ea4bb97306ae9807caadca6782358679f38d3afd606cb599b6853bc52  docker-containerd-v0.2.2.tar.gz
diff --git a/package/docker-containerd/docker-containerd.mk b/package/docker-containerd/docker-containerd.mk
new file mode 100644
index 0000000..902d63f
--- /dev/null
+++ b/package/docker-containerd/docker-containerd.mk
@@ -0,0 +1,44 @@
+################################################################################
+#
+# docker-containerd
+#
+################################################################################
+
+DOCKER_CONTAINERD_VERSION = v0.2.2
+DOCKER_CONTAINERD_SITE = $(call github,docker,containerd,$(DOCKER_CONTAINERD_VERSION))
+
+DOCKER_CONTAINERD_LICENSE = Apache-2.0
+DOCKER_CONTAINERD_LICENSE_FILES = LICENSE.code
+
+DOCKER_CONTAINERD_DEPENDENCIES = host-go
+
+DOCKER_CONTAINERD_GOPATH = "$(@D)/vendor"
+DOCKER_CONTAINERD_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
+	CGO_ENABLED=1 \
+	GOBIN="$(@D)/bin" \
+	GOPATH="$(DOCKER_CONTAINERD_GOPATH)"
+
+DOCKER_CONTAINERD_GLDFLAGS = \
+	-X github.com/docker/containerd.GitCommit=$(DOCKER_CONTAINERD_VERSION) \
+	-extldflags '-static'
+
+define DOCKER_CONTAINERD_CONFIGURE_CMDS
+	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker
+	ln -s $(@D) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker/containerd
+	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers
+	ln -s $(RUNC_SRCDIR) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers/runc
+endef
+
+define DOCKER_CONTAINERD_BUILD_CMDS
+	cd $(@D); $(DOCKER_CONTAINERD_MAKE_ENV) $(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/ctr -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./ctr
+	cd $(@D); $(DOCKER_CONTAINERD_MAKE_ENV) $(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/containerd -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./containerd
+	cd $(@D); $(DOCKER_CONTAINERD_MAKE_ENV) $(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/containerd-shim -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./containerd-shim
+endef
+
+define DOCKER_CONTAINERD_INSTALL_TARGET_CMDS
+	ln -fs runc $(TARGET_DIR)/usr/bin/docker-runc
+	$(INSTALL) -D -m 0755 $(@D)/bin/containerd $(TARGET_DIR)/usr/bin/docker-containerd
+	$(INSTALL) -D -m 0755 $(@D)/bin/containerd-shim $(TARGET_DIR)/usr/bin/containerd-shim
+endef
+
+$(eval $(generic-package))
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-05-28 22:46 [Buildroot] [PATCH v6 0/3] Add docker engine support Christian Stewart
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 1/3] runc: new package Christian Stewart
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 2/3] docker-containerd: " Christian Stewart
@ 2016-05-28 22:46 ` Christian Stewart
  2016-06-07 19:43   ` Andrew Webster
  2016-07-04 16:13   ` Romain Naour
  2016-06-27 22:22 ` [Buildroot] [PATCH v6 0/3] Add docker engine support Christian Stewart
  3 siblings, 2 replies; 22+ messages in thread
From: Christian Stewart @ 2016-05-28 22:46 UTC (permalink / raw)
  To: buildroot

Docker is a platform to build, ship, and run applications in portable
containers.

Signed-off-by: Christian Stewart <christian@paral.in>

---

Changes since v1:
 - use call github to build source URL
Changes since v3:
 - fix help indentation in Config.in
 - use HOST_GO_TARGET_ENV as a base for build env vars
 - cleanup build commands
 - cleanup GOPATH and vendor directory setup
 - Remove selections for graph drivers. Docker will gracefully degrade
   at runtime to the best available graphdriver. It is unnecessary to
   disable these at build time, or to pull in any other dependencies
   like aufs-util or btrfs tools. The daemon will use whatever is
   available at runtime.
Changes since v4:
 - remove commit hash from version scheme
Changes since v5:
 - re-introduce graphdriver selections
 - these selections are required for btrfs and devicemapper
 - there are buildtime dependencies on headers.
 - add BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS dep to threading comment

---
 package/Config.in                        |  1 +
 package/docker-engine/Config.in          | 69 ++++++++++++++++++++++
 package/docker-engine/docker-engine.hash |  2 +
 package/docker-engine/docker-engine.mk   | 99 ++++++++++++++++++++++++++++++++
 4 files changed, 171 insertions(+)
 create mode 100644 package/docker-engine/Config.in
 create mode 100644 package/docker-engine/docker-engine.hash
 create mode 100644 package/docker-engine/docker-engine.mk

diff --git a/package/Config.in b/package/Config.in
index c8365f8..b829075 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1632,6 +1632,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/debianutils/Config.in"
 endif
 	source "package/docker-containerd/Config.in"
+	source "package/docker-engine/Config.in"
 	source "package/cgroupfs-mount/Config.in"
 	source "package/dsp-tools/Config.in"
 	source "package/emlog/Config.in"
diff --git a/package/docker-engine/Config.in b/package/docker-engine/Config.in
new file mode 100644
index 0000000..bbf56b1
--- /dev/null
+++ b/package/docker-engine/Config.in
@@ -0,0 +1,69 @@
+config BR2_PACKAGE_DOCKER_ENGINE
+	bool "docker-engine"
+	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_USE_MMU # util-linux
+	depends on BR2_USE_WCHAR # util-linux
+	select BR2_PACKAGE_DOCKER_CONTAINERD
+	select BR2_PACKAGE_RUNC
+	select BR2_PACKAGE_SQLITE
+	select BR2_PACKAGE_UTIL_LINUX
+	select BR2_PACKAGE_UTIL_LINUX_BINARIES
+	select BR2_PACKAGE_UTIL_LINUX_PIVOT_ROOT
+	select BR2_PACKAGE_UTIL_LINUX_MOUNTPOINT
+	select BR2_PACKAGE_UTIL_LINUX_MOUNT
+	help
+	  Docker is a platform to build, ship,
+	  and run applications as lightweight containers.
+
+	  https://github.com/docker/docker
+
+comment "docker-engine needs a toolchain w/ threads"
+	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
+
+if BR2_PACKAGE_DOCKER_ENGINE
+
+config BR2_PACKAGE_DOCKER_ENGINE_DAEMON
+	bool "docker daemon"
+	default y
+	help
+	  Build the Docker system daemon.
+	  If not selected, will build client only.
+
+config BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL
+	bool "build experimental features"
+
+if BR2_PACKAGE_DOCKER_ENGINE_DAEMON
+
+config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS
+	bool "btrfs filesystem driver"
+	depends on BR2_USE_WCHAR # btrfs-progs
+	depends on BR2_USE_MMU # btrfs-progs
+	depends on BR2_TOOLCHAIN_HAS_THREADS # btrfs-progs
+	select BR2_PACKAGE_BTRFS_PROGS
+	help
+	  Build the btrfs filesystem driver for Docker.
+
+config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_DEVICEMAPPER
+	bool "devicemapper filesystem driver"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # lvm2
+	depends on BR2_USE_MMU # lvm2
+	depends on !BR2_STATIC_LIBS # lvm2
+	select BR2_PACKAGE_LVM2
+	select BR2_PACKAGE_LVM2_APP_LIBRARY
+	help
+	  Build the devicemapper filesystem driver for Docker.
+
+config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS
+	bool "vfs filesystem driver"
+	depends on BR2_USE_WCHAR # gvfs
+	depends on BR2_USE_MMU # gvfs
+	depends on BR2_TOOLCHAIN_HAS_THREADS # gvfs
+	select BR2_PACKAGE_GVFS
+	help
+	  Build the vfs filesystem driver for Docker.
+
+endif
+
+endif
diff --git a/package/docker-engine/docker-engine.hash b/package/docker-engine/docker-engine.hash
new file mode 100644
index 0000000..7b93669
--- /dev/null
+++ b/package/docker-engine/docker-engine.hash
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 04de3750738b6f888f03520fb67db22e95e8a8e016ae901428e6c5791c9841cc  docker-engine-v1.11.1.tar.gz
diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk
new file mode 100644
index 0000000..b7407b2
--- /dev/null
+++ b/package/docker-engine/docker-engine.mk
@@ -0,0 +1,99 @@
+################################################################################
+#
+# docker-engine
+#
+################################################################################
+
+DOCKER_ENGINE_VERSION = v1.11.1
+DOCKER_ENGINE_SITE = $(call github,docker,docker,$(DOCKER_ENGINE_VERSION))
+
+DOCKER_ENGINE_LICENSE = Apache-2.0
+DOCKER_ENGINE_LICENSE_FILES = LICENSE
+
+DOCKER_ENGINE_DEPENDENCIES = host-go docker-containerd
+
+DOCKER_ENGINE_GOPATH = "$(@D)/vendor"
+DOCKER_ENGINE_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
+	CGO_ENABLED=1 \
+	CGO_NO_EMULATION=1 \
+	GOBIN="$(@D)/bin" \
+	GOPATH="$(DOCKER_ENGINE_GOPATH)"
+
+DOCKER_ENGINE_GLDFLAGS = \
+	-X main.GitCommit=$(DOCKER_ENGINE_VERSION) \
+	-X main.Version=$(DOCKER_ENGINE_VERSION) \
+	-extldflags '-static'
+
+DOCKER_ENGINE_BUILD_TAGS = cgo exclude_graphdriver_zfs
+
+ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
+DOCKER_ENGINE_BUILD_TAGS += seccomp
+DOCKER_ENGINE_DEPENDENCIES += libseccomp
+endif
+
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y)
+DOCKER_ENGINE_BUILD_TAGS += daemon
+endif
+
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL),y)
+DOCKER_ENGINE_BUILD_TAGS += experimental
+endif
+
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS),y)
+DOCKER_ENGINE_DEPENDENCIES += btrfs-progs
+else
+DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_btrfs
+endif
+
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_DEVICEMAPPER),y)
+DOCKER_ENGINE_DEPENDENCIES += lvm2
+else
+DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_devicemapper
+endif
+
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS),y)
+DOCKER_ENGINE_DEPENDENCIES += gvfs
+else
+DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_vfs
+endif
+
+define DOCKER_ENGINE_CONFIGURE_CMDS
+	$(SED) '/^clean$$/d' $(@D)/hack/vendor.sh
+	cd $(@D) && bash ./hack/vendor.sh
+	mkdir -p $(DOCKER_ENGINE_GOPATH)/src/github.com/docker
+	ln -fs $(@D) $(DOCKER_ENGINE_GOPATH)/src/github.com/docker/docker
+	ln -fs $(DOCKER_CONTAINERD_SRCDIR) $(DOCKER_ENGINE_GOPATH)/src/github.com/docker/containerd
+	mkdir -p $(DOCKER_ENGINE_GOPATH)/src/github.com/opencontainers
+	ln -fs $(RUNC_SRCDIR) $(DOCKER_ENGINE_GOPATH)/src/github.com/opencontainers/runc
+endef
+
+define DOCKER_ENGINE_BUILD_CMDS
+	cd $(@D); $(DOCKER_ENGINE_MAKE_ENV) $(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/docker -tags "$(DOCKER_ENGINE_BUILD_TAGS)" -ldflags "$(DOCKER_ENGINE_GLDFLAGS)" ./docker
+endef
+
+define DOCKER_ENGINE_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/bin/docker $(TARGET_DIR)/usr/bin/docker
+endef
+
+define DOCKER_ENGINE_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 0644 $(@D)/contrib/init/systemd/docker.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/docker.service
+	$(INSTALL) -D -m 0644 $(@D)/contrib/init/systemd/docker.socket \
+		$(TARGET_DIR)/usr/lib/systemd/system/docker.socket
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/
+	ln -fs ../../../../usr/lib/systemd/system/docker.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/docker.service
+endef
+
+define DOCKER_ENGINE_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 755 $(@D)/contrib/init/sysvinit-redhat/docker \
+		$(TARGET_DIR)/etc/init.d/S61docker
+	$(INSTALL) -D -m 644 $(@D)/contrib/init/sysvinit-redhat/docker.sysconfig \
+		$(TARGET_DIR)/etc/sysconfig/docker.sysconfig
+endef
+
+define DOCKER_ENGINE_USERS
+	- - docker -1 * - - - Docker Application Container Framework
+endef
+
+$(eval $(generic-package))
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 3/3] docker-engine: " Christian Stewart
@ 2016-06-07 19:43   ` Andrew Webster
  2016-06-07 19:54     ` Thomas Petazzoni
  2016-07-04 16:13   ` Romain Naour
  1 sibling, 1 reply; 22+ messages in thread
From: Andrew Webster @ 2016-06-07 19:43 UTC (permalink / raw)
  To: buildroot

Christian,

Nice work.  This opens some interesting possibilities.  

See comments below.

> -----Original Message-----
> From: buildroot [mailto:buildroot-bounces at busybox.net] On Behalf Of
> Christian Stewart
> Sent: Saturday, May 28, 2016 6:46 PM

> diff --git a/package/docker-engine/Config.in b/package/docker-
> engine/Config.in new file mode 100644 index 0000000..bbf56b1
> --- /dev/null
> +++ b/package/docker-engine/Config.in
> @@ -0,0 +1,69 @@
> +config BR2_PACKAGE_DOCKER_ENGINE
> +	bool "docker-engine"
> +	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
> +	depends on BR2_TOOLCHAIN_HAS_THREADS
> +	depends on BR2_USE_MMU # util-linux
> +	depends on BR2_USE_WCHAR # util-linux
> +	select BR2_PACKAGE_DOCKER_CONTAINERD
> +	select BR2_PACKAGE_RUNC
> +	select BR2_PACKAGE_SQLITE
> +	select BR2_PACKAGE_UTIL_LINUX
> +	select BR2_PACKAGE_UTIL_LINUX_BINARIES
> +	select BR2_PACKAGE_UTIL_LINUX_PIVOT_ROOT
> +	select BR2_PACKAGE_UTIL_LINUX_MOUNTPOINT
> +	select BR2_PACKAGE_UTIL_LINUX_MOUNT

Does it makes sense to also add selects for BR2_PACKAGE_IPTABLES and BR2_PACKAGE_CA_CERTIFICATES here?  They are not build dependencies, but run-time dependencies.  It may be possible to do some things without the certificates, but I think iptables is always required.

On a similar topic, docker expects a bunch of cgroup mounts to exist somewhere on the system.  Is this something that should be left up to the rootfs author (in which case maybe the help could be extended to explain this), or should the docker-engine recipe attempt to modify fstab somehow?  I'm not sure if there is a way to actually do that though.

> +	help
> +	  Docker is a platform to build, ship,
> +	  and run applications as lightweight containers.
> +
> +	  https://github.com/docker/docker
> +
> +comment "docker-engine needs a toolchain w/ threads"
> +	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
> +	depends on !BR2_TOOLCHAIN_HAS_THREADS

This comment should probably be moved to the top so that the items in the below "if" are organized as children of DOCKER_ENGINE in the config GUI's.

> +
> +if BR2_PACKAGE_DOCKER_ENGINE
> +
> +config BR2_PACKAGE_DOCKER_ENGINE_DAEMON
> +	bool "docker daemon"
> +	default y
> +	help
> +	  Build the Docker system daemon.
> +	  If not selected, will build client only.
> +
> +config BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL
> +	bool "build experimental features"
> +
> +if BR2_PACKAGE_DOCKER_ENGINE_DAEMON
> +
> +config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS
> +	bool "btrfs filesystem driver"
> +	depends on BR2_USE_WCHAR # btrfs-progs
> +	depends on BR2_USE_MMU # btrfs-progs
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # btrfs-progs
> +	select BR2_PACKAGE_BTRFS_PROGS
> +	help
> +	  Build the btrfs filesystem driver for Docker.
> +
> +config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_DEVICEMAPPER
> +	bool "devicemapper filesystem driver"
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # lvm2
> +	depends on BR2_USE_MMU # lvm2
> +	depends on !BR2_STATIC_LIBS # lvm2
> +	select BR2_PACKAGE_LVM2
> +	select BR2_PACKAGE_LVM2_APP_LIBRARY
> +	help
> +	  Build the devicemapper filesystem driver for Docker.
> +
> +config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS
> +	bool "vfs filesystem driver"
> +	depends on BR2_USE_WCHAR # gvfs
> +	depends on BR2_USE_MMU # gvfs
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # gvfs
> +	select BR2_PACKAGE_GVFS
> +	help
> +	  Build the vfs filesystem driver for Docker.
> +
> +endif
> +
> +endif

> diff --git a/package/docker-engine/docker-engine.mk b/package/docker-
> engine/docker-engine.mk
> new file mode 100644
> index 0000000..b7407b2
> --- /dev/null
> +++ b/package/docker-engine/docker-engine.mk
> @@ -0,0 +1,99 @@
> +#########################################################
> ##############
> +#########
> +#
> +# docker-engine
> +#
> +#########################################################
> ##############
> +#########
> +
> +DOCKER_ENGINE_VERSION = v1.11.1
> +DOCKER_ENGINE_SITE = $(call
> +github,docker,docker,$(DOCKER_ENGINE_VERSION))
> +
> +DOCKER_ENGINE_LICENSE = Apache-2.0
> +DOCKER_ENGINE_LICENSE_FILES = LICENSE
> +
> +DOCKER_ENGINE_DEPENDENCIES = host-go docker-containerd
> +
> +DOCKER_ENGINE_GOPATH = "$(@D)/vendor"
> +DOCKER_ENGINE_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
> +	CGO_ENABLED=1 \
> +	CGO_NO_EMULATION=1 \
> +	GOBIN="$(@D)/bin" \
> +	GOPATH="$(DOCKER_ENGINE_GOPATH)"
> +
> +DOCKER_ENGINE_GLDFLAGS = \
> +	-X main.GitCommit=$(DOCKER_ENGINE_VERSION) \
> +	-X main.Version=$(DOCKER_ENGINE_VERSION) \
> +	-extldflags '-static'
> +
> +DOCKER_ENGINE_BUILD_TAGS = cgo exclude_graphdriver_zfs
> +
> +ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
> +DOCKER_ENGINE_BUILD_TAGS += seccomp
> +DOCKER_ENGINE_DEPENDENCIES += libseccomp endif
> +
> +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y)
> +DOCKER_ENGINE_BUILD_TAGS += daemon
> +endif
> +
> +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL),y)
> +DOCKER_ENGINE_BUILD_TAGS += experimental endif
> +
> +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS),y)
> +DOCKER_ENGINE_DEPENDENCIES += btrfs-progs else
> DOCKER_ENGINE_BUILD_TAGS
> ++= exclude_graphdriver_btrfs endif
> +
> +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_DEVICEMAPPER),y)
> +DOCKER_ENGINE_DEPENDENCIES += lvm2
> +else
> +DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_devicemapper
> endif
> +
> +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS),y)
> +DOCKER_ENGINE_DEPENDENCIES += gvfs
> +else
> +DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_vfs endif
> +
> +define DOCKER_ENGINE_CONFIGURE_CMDS
> +	$(SED) '/^clean$$/d' $(@D)/hack/vendor.sh
> +	cd $(@D) && bash ./hack/vendor.sh
> +	mkdir -p $(DOCKER_ENGINE_GOPATH)/src/github.com/docker
> +	ln -fs $(@D)
> $(DOCKER_ENGINE_GOPATH)/src/github.com/docker/docker
> +	ln -fs $(DOCKER_CONTAINERD_SRCDIR)
> $(DOCKER_ENGINE_GOPATH)/src/github.com/docker/containerd
> +	mkdir -p
> $(DOCKER_ENGINE_GOPATH)/src/github.com/opencontainers
> +	ln -fs $(RUNC_SRCDIR)
> +$(DOCKER_ENGINE_GOPATH)/src/github.com/opencontainers/runc
> +endef
> +
> +define DOCKER_ENGINE_BUILD_CMDS
> +	cd $(@D); $(DOCKER_ENGINE_MAKE_ENV) $(HOST_DIR)/usr/bin/go
> build -v -o
> +$(@D)/bin/docker -tags "$(DOCKER_ENGINE_BUILD_TAGS)" -ldflags
> +"$(DOCKER_ENGINE_GLDFLAGS)" ./docker endef
> +
> +define DOCKER_ENGINE_INSTALL_TARGET_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/bin/docker
> $(TARGET_DIR)/usr/bin/docker
> +endef
> +
> +define DOCKER_ENGINE_INSTALL_INIT_SYSTEMD
> +	$(INSTALL) -D -m 0644 $(@D)/contrib/init/systemd/docker.service \
> +		$(TARGET_DIR)/usr/lib/systemd/system/docker.service
> +	$(INSTALL) -D -m 0644 $(@D)/contrib/init/systemd/docker.socket \
> +		$(TARGET_DIR)/usr/lib/systemd/system/docker.socket
> +	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-
> user.target.wants/
> +	ln -fs ../../../../usr/lib/systemd/system/docker.service \
> +
> +$(TARGET_DIR)/etc/systemd/system/multi-
> user.target.wants/docker.service
> +endef
> +
> +define DOCKER_ENGINE_INSTALL_INIT_SYSV
> +	$(INSTALL) -D -m 755 $(@D)/contrib/init/sysvinit-redhat/docker \
> +		$(TARGET_DIR)/etc/init.d/S61docker

This init file didn't work for me.  I'm not sure if it can work on a buildroot filesystem, are you using systemd instead?
I removed most of the checks to get it working (actually, I think I started editing the Ubuntu version).  Maybe a custom init script is required?  I can show you my hack if you like.

> +	$(INSTALL) -D -m 644 $(@D)/contrib/init/sysvinit-
> redhat/docker.sysconfig \
> +		$(TARGET_DIR)/etc/sysconfig/docker.sysconfig
> +endef
> +
> +define DOCKER_ENGINE_USERS
> +	- - docker -1 * - - - Docker Application Container Framework endef
> +
> +$(eval $(generic-package)) 

Andrew

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-06-07 19:43   ` Andrew Webster
@ 2016-06-07 19:54     ` Thomas Petazzoni
  2016-06-07 20:10       ` Andrew Webster
  2016-06-07 20:18       ` Christian Stewart
  0 siblings, 2 replies; 22+ messages in thread
From: Thomas Petazzoni @ 2016-06-07 19:54 UTC (permalink / raw)
  To: buildroot

Hello,

Thanks for your feedback. However, it'd be nice if you could configure
your e-mail client to wrap lines at a reasonable length.

On Tue, 7 Jun 2016 19:43:53 +0000, Andrew Webster wrote:

> Does it makes sense to also add selects for BR2_PACKAGE_IPTABLES and
> BR2_PACKAGE_CA_CERTIFICATES here?  They are not build dependencies,
> but run-time dependencies.  It may be possible to do some things
> without the certificates, but I think iptables is always required.

It is indeed a good idea to select the relevant runtime dependencies.

> On a similar topic, docker expects a bunch of cgroup mounts to exist
> somewhere on the system.  Is this something that should be left up to
> the rootfs author (in which case maybe the help could be extended to
> explain this), or should the docker-engine recipe attempt to modify
> fstab somehow?  I'm not sure if there is a way to actually do that
> though.

The Buildroot philosophy is in general that things should work at least
in a minimal way "out of the box". So if cgroup mounts are needed for
Docker, they should be done in Docker's init script.

> > +define DOCKER_ENGINE_INSTALL_INIT_SYSV
> > +	$(INSTALL) -D -m 755
> > $(@D)/contrib/init/sysvinit-redhat/docker \
> > +		$(TARGET_DIR)/etc/init.d/S61docker  
> 
> This init file didn't work for me.  I'm not sure if it can work on a
> buildroot filesystem, are you using systemd instead? I removed most
> of the checks to get it working (actually, I think I started editing
> the Ubuntu version).  Maybe a custom init script is required?  I can
> show you my hack if you like.

Very often, init scripts provided by upstream for desktop/server
distributions don't work really well with Buildroot generated systems.
Because we don't have bash by default, because we don't necessarily
have all the tools they need in our default image, and for various
other reasons. That's why we generally have our own Buildroot-specific
init script in the package directory.

So a custom init script is probably in order here, especially if you
report that the one provided by upstream doesn't quite work.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-06-07 19:54     ` Thomas Petazzoni
@ 2016-06-07 20:10       ` Andrew Webster
  2016-06-07 20:18       ` Christian Stewart
  1 sibling, 0 replies; 22+ messages in thread
From: Andrew Webster @ 2016-06-07 20:10 UTC (permalink / raw)
  To: buildroot

> From: Thomas Petazzoni [mailto:thomas.petazzoni at free-electrons.com]
> Sent: Tuesday, June 07, 2016 3:55 PM
 
> Thanks for your feedback. However, it'd be nice if you could configure your e-mail client to wrap lines at a reasonable length.

Sorry, I just noticed that.  It's also mangling some of the incoming text as well.  I'll try and figure that out.

> > On a similar topic, docker expects a bunch of cgroup mounts to exist
> > somewhere on the system.  Is this something that should be left up to
> > the rootfs author (in which case maybe the help could be extended to
> > explain this), or should the docker-engine recipe attempt to modify
> > fstab somehow?  I'm not sure if there is a way to actually do that
> > though.
> 
> The Buildroot philosophy is in general that things should work at least in a minimal way "out of the box". So if cgroup mounts are
> needed for Docker, they should be done in Docker's init script.

Ahh, right.  I missed that part when I made my custom init.  The debian/redhat versions do attempt to do this.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 2/3] docker-containerd: new package
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 2/3] docker-containerd: " Christian Stewart
@ 2016-06-07 20:15   ` Andrew Webster
  2016-06-07 20:24     ` Christian Stewart
  2016-07-04 17:43   ` Romain Naour
  1 sibling, 1 reply; 22+ messages in thread
From: Andrew Webster @ 2016-06-07 20:15 UTC (permalink / raw)
  To: buildroot

> -----Original Message-----
> From: buildroot [mailto:buildroot-bounces at busybox.net] On Behalf Of Christian Stewart
> Sent: Saturday, May 28, 2016 6:46 PM

> +define DOCKER_CONTAINERD_INSTALL_TARGET_CMDS
> +	ln -fs runc $(TARGET_DIR)/usr/bin/docker-runc
> +	$(INSTALL) -D -m 0755 $(@D)/bin/containerd $(TARGET_DIR)/usr/bin/docker-containerd
> +	$(INSTALL) -D -m 0755 $(@D)/bin/containerd-shim $(TARGET_DIR)/usr/bin/containerd-shim
> +endef

Should this target be $(TARGET_DIR)/usr/bin/docker-containerd-shim instead?
 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-06-07 19:54     ` Thomas Petazzoni
  2016-06-07 20:10       ` Andrew Webster
@ 2016-06-07 20:18       ` Christian Stewart
  2016-06-07 20:37         ` Andrew Webster
  1 sibling, 1 reply; 22+ messages in thread
From: Christian Stewart @ 2016-06-07 20:18 UTC (permalink / raw)
  To: buildroot

Thomas, Andrew,

On Tue, Jun 7, 2016 at 12:54 PM, Thomas Petazzoni <
thomas.petazzoni@free-electrons.com> wrote:
>
> > Does it makes sense to also add selects for BR2_PACKAGE_IPTABLES and
> > BR2_PACKAGE_CA_CERTIFICATES here?  They are not build dependencies,
> > but run-time dependencies.  It may be possible to do some things
> > without the certificates, but I think iptables is always required.
>

Not sure if these are actually required. The iptables calls are direct, not
through calling a cli.

Certs are a different story but that might be out of the scope of the
Docker package. It can run stuff locally without hitting the internet at
all.

> On a similar topic, docker expects a bunch of cgroup mounts to exist
> > somewhere on the system.  Is this something that should be left up to
> > the rootfs author (in which case maybe the help could be extended to
> > explain this), or should the docker-engine recipe attempt to modify
> > fstab somehow?  I'm not sure if there is a way to actually do that
> > though.
>

This is unnecessary. On all of the systems I'm running, with NO fstab
modifications or really anything but enabling the Docker package, it works
fine. Docker might be doing the mounting automatically.

> > +define DOCKER_ENGINE_INSTALL_INIT_SYSV
> > > +   $(INSTALL) -D -m 755
> > > $(@D)/contrib/init/sysvinit-redhat/docker \
> > > +           $(TARGET_DIR)/etc/init.d/S61docker
> >
> > This init file didn't work for me.  I'm not sure if it can work on a
> > buildroot filesystem, are you using systemd instead? I removed most
> > of the checks to get it working (actually, I think I started editing
> > the Ubuntu version).  Maybe a custom init script is required?  I can
> > show you my hack if you like.
>

I didn't expect this to work, and was hoping someone who's not using
systemd would contribute a better init script for it.

I'd appreciate seeing your script if you manage to get one that works well
for you under Buildroot's shell based init sequence.

So a custom init script is probably in order here, especially if you
> report that the one provided by upstream doesn't quite work.
>

+1

For reference, here's my system setup:  http://github.com/paralin/SkiffOS

It's actually a very extensible configuration generation platform, I'm
hoping to expand its scope soon, if anyone would like to
have a look and give me any comments, they would be greatly appreciated :)

Thanks!
Christian Stewart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160607/e99897ea/attachment.html>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 2/3] docker-containerd: new package
  2016-06-07 20:15   ` Andrew Webster
@ 2016-06-07 20:24     ` Christian Stewart
  0 siblings, 0 replies; 22+ messages in thread
From: Christian Stewart @ 2016-06-07 20:24 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, Jun 7, 2016 at 1:15 PM, Andrew Webster <Awebster@arcx.com> wrote:
>
> > +define DOCKER_CONTAINERD_INSTALL_TARGET_CMDS
> > +     ln -fs runc $(TARGET_DIR)/usr/bin/docker-runc
> > +     $(INSTALL) -D -m 0755 $(@D)/bin/containerd
> $(TARGET_DIR)/usr/bin/docker-containerd
> > +     $(INSTALL) -D -m 0755 $(@D)/bin/containerd-shim
> $(TARGET_DIR)/usr/bin/containerd-shim
> > +endef
>
> Should this target be $(TARGET_DIR)/usr/bin/docker-containerd-shim instead?
>

Yes, and this is fixed for the next revision, see:

https://github.com/paralin/buildroot/commit/39ca2e6f7ce4e23c2a9ff0016ff3680299b4f91b

~ Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160607/6d5541c7/attachment.html>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-06-07 20:18       ` Christian Stewart
@ 2016-06-07 20:37         ` Andrew Webster
  2016-06-07 20:47           ` Thomas Petazzoni
  0 siblings, 1 reply; 22+ messages in thread
From: Andrew Webster @ 2016-06-07 20:37 UTC (permalink / raw)
  To: buildroot

> From: Christian Stewart [mailto:christian at paral.in] 
> Sent: Tuesday, June 07, 2016 4:18 PM

> > Does it makes sense to also add selects for BR2_PACKAGE_IPTABLES and
> > BR2_PACKAGE_CA_CERTIFICATES here?? They are not build dependencies,
> > but run-time dependencies.? It may be possible to do some things
> > without the certificates, but I think iptables is always required.

> Not sure if these are actually required. The iptables calls are direct, not through calling a cli.

On my system, if I don't have the iptables executable in the path, docker fails to start with the following:

FATA[0001] Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain: Iptables not found

Have I misconfigured something?

> Certs are a different story but that might be out of the scope of the Docker package. It can run stuff locally without hitting the internet at all.

Yup.  I guess there's no formal way to "recommend" a package.

> > On a similar topic, docker expects a bunch of cgroup mounts to exist
> > somewhere on the system.? Is this something that should be left up to
> > the rootfs author (in which case maybe the help could be extended to
> > explain this), or should the docker-engine recipe attempt to modify
> > fstab somehow?? I'm not sure if there is a way to actually do that
> > though.

> This is unnecessary. On all of the systems I'm running, with NO fstab modifications or really anything but enabling the Docker package, it works fine. Docker might be doing the mounting automatically.

You are correct.  This was my fault, I missed doing the mounts in the init.  Let me correct it, then I'll send it out.

Andrew

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-06-07 20:37         ` Andrew Webster
@ 2016-06-07 20:47           ` Thomas Petazzoni
  2016-06-08 15:29             ` Andrew Webster
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Petazzoni @ 2016-06-07 20:47 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 7 Jun 2016 20:37:51 +0000, Andrew Webster wrote:

> > Certs are a different story but that might be out of the scope of
> > the Docker package. It can run stuff locally without hitting the
> > internet at all.  
> 
> Yup.  I guess there's no formal way to "recommend" a package.

The best thing we can do in the context of Buildroot is to add a note
in the help text of the package in its Config.in file.

Something like:

	  Make sure to enable the ca-certificates package if you want
	  docker-engine to be able to ....

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-06-07 20:47           ` Thomas Petazzoni
@ 2016-06-08 15:29             ` Andrew Webster
  2016-06-27 23:02               ` Christian Stewart
  0 siblings, 1 reply; 22+ messages in thread
From: Andrew Webster @ 2016-06-08 15:29 UTC (permalink / raw)
  To: buildroot

Here is a patch with the init file I used.  I copied the contrib/init/sysvinit-debian/docker file and modified it slightly.

In start), the stdout/stderr of start-stop-daemon is logged to $DOCKER_LOGFILE.  I suspect that the intention was to actually log the stdout/stderr of docker, not start-stop-daemon, but I have left it as it was in the original file.

Author: Andrew Webster <awebster@arcx.com>
Date:   Mon Jun 6 14:53:08 2016 -0400

    docker-engine: switch sysv init to custom file
    
    The packaged redhat init file is not suitable for buildroot.
    This adds a customized version for buildroot.

    Signed-off-by: Andrew Webster <awebster@arcx.com>

diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk
index b7407b2..17e4516 100644
--- a/package/docker-engine/docker-engine.mk
+++ b/package/docker-engine/docker-engine.mk
@@ -86,10 +86,10 @@ define DOCKER_ENGINE_INSTALL_INIT_SYSTEMD
 endef
 
 define DOCKER_ENGINE_INSTALL_INIT_SYSV
-    $(INSTALL) -D -m 755 $(@D)/contrib/init/sysvinit-redhat/docker \
+    $(INSTALL) -D -m 755 package/docker-engine/docker.init \
         $(TARGET_DIR)/etc/init.d/S61docker
-    $(INSTALL) -D -m 644 $(@D)/contrib/init/sysvinit-redhat/docker.sysconfig \
-        $(TARGET_DIR)/etc/sysconfig/docker.sysconfig
+    $(INSTALL) -D -m 644 $(@D)/contrib/init/sysvinit-debian/docker.default \
+        $(TARGET_DIR)/etc/default/docker
 endef
 
 define DOCKER_ENGINE_USERS
diff --git a/package/docker-engine/docker.init b/package/docker-engine/docker.init
new file mode 100755
index 0000000..9efa925
--- /dev/null
+++ b/package/docker-engine/docker.init
@@ -0,0 +1,111 @@
+#!/bin/sh
+set -e
+
+### BEGIN INIT INFO
+# Provides:           docker
+# Required-Start:     $syslog $remote_fs
+# Required-Stop:      $syslog $remote_fs
+# Should-Start:       cgroupfs-mount cgroup-lite
+# Should-Stop:        cgroupfs-mount cgroup-lite
+# Default-Start:      2 3 4 5
+# Default-Stop:       0 1 6
+# Short-Description:  Create lightweight, portable, self-sufficient containers.
+# Description:
+#  Docker is an open-source project to easily create lightweight, portable,
+#  self-sufficient containers from any application. The same container that a
+#  developer builds and tests on a laptop can run at scale, in production, on
+#  VMs, bare metal, OpenStack clusters, public clouds and more.
+### END INIT INFO
+
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
+
+BASE=docker
+
+DOCKER=/usr/bin/$BASE
+# This is the pid file managed by docker itself
+DOCKER_PIDFILE=/var/run/$BASE.pid
+# This is the pid file created/managed by start-stop-daemon
+DOCKER_SSD_PIDFILE=/var/run/$BASE-ssd.pid
+DOCKER_LOGFILE=/var/log/$BASE.log
+DOCKER_OPTS=
+DOCKER_DESC="Docker"
+
+if [ -f /etc/default/$BASE ]; then
+    . /etc/default/$BASE
+fi
+
+# Check docker is present
+if [ ! -x $DOCKER ]; then
+    echo "$DOCKER not present or not executable"
+    exit 1
+fi
+
+cgroupfs_mount() {
+    # see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
+    if grep -v '^#' /etc/fstab | grep -q cgroup \
+        || [ ! -e /proc/cgroups ] \
+        || [ ! -d /sys/fs/cgroup ]; then
+        return
+    fi
+    if ! mountpoint -q /sys/fs/cgroup; then
+        mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
+    fi
+    (
+        cd /sys/fs/cgroup
+        for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
+            mkdir -p $sys
+            if ! mountpoint -q $sys; then
+                if ! mount -n -t cgroup -o $sys cgroup $sys; then
+                    rmdir $sys || true
+                fi
+            fi
+        done
+    )
+}
+
+case "$1" in
+    start)
+        cgroupfs_mount
+
+        ulimit -n 1048576
+        if [ "$BASH" ]; then
+            ulimit -u 1048576
+        else
+            ulimit -p 1048576
+        fi
+
+        echo "Starting $DOCKER_DESC: $BASE"
+        start-stop-daemon --start --background \
+            --exec "$DOCKER" \
+            --pidfile "$DOCKER_SSD_PIDFILE" \
+            --make-pidfile \
+            -- \
+                daemon -p "$DOCKER_PIDFILE" \
+                $DOCKER_OPTS \
+                    >> "$DOCKER_LOGFILE" 2>&1
+        echo $?
+        ;;
+
+    stop)
+        echo "Stopping $DOCKER_DESC: $BASE"
+        start-stop-daemon --stop --pidfile "$DOCKER_SSD_PIDFILE" --retry 10
+        echo $?
+        ;;
+
+    restart)
+        docker_pid=`cat "$DOCKER_SSD_PIDFILE" 2>/dev/null`
+        [ -n "$docker_pid" ] \
+            && ps -p $docker_pid > /dev/null 2>&1 \
+            && $0 stop
+        $0 start
+        ;;
+
+    force-reload)
+        $0 restart
+        ;;
+
+    *)
+        echo "Usage: service docker {start|stop|restart}"
+        exit 1
+        ;;
+esac

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 0/3] Add docker engine support
  2016-05-28 22:46 [Buildroot] [PATCH v6 0/3] Add docker engine support Christian Stewart
                   ` (2 preceding siblings ...)
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 3/3] docker-engine: " Christian Stewart
@ 2016-06-27 22:22 ` Christian Stewart
  3 siblings, 0 replies; 22+ messages in thread
From: Christian Stewart @ 2016-06-27 22:22 UTC (permalink / raw)
  To: buildroot

All,
On Sat, May 28, 2016 at 3:46 PM Christian Stewart <christian@paral.in> wrote:
> This series adds runc, docker-containerd, and docker-engine support.
Quick update regarding dependencies. As of Docker v1.12-rc2 all dependency code
is vendored into the Git tree itself. This means that the repo tarball actually
contains all of the build-time Go dependencies in it, and no extra Git fetches
are required. This should fix the problem with pulling additional code snapshots
at build time.
~ Christian Stewart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160627/3428f419/attachment.html>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-06-08 15:29             ` Andrew Webster
@ 2016-06-27 23:02               ` Christian Stewart
  2016-06-28 15:21                 ` Andrew Webster
  0 siblings, 1 reply; 22+ messages in thread
From: Christian Stewart @ 2016-06-27 23:02 UTC (permalink / raw)
  To: buildroot

Andrew,
On Tue, Jun 7, 2016 at 1:18 PM Andrew Webster <Awebster@arcx.com> wrote:
> Here is a patch with the init file I used. I copied the
contrib/init/sysvinit-debian/docker file and modified it slightly.
Thank you again for this patch. It doesn't apply to my latest version of
docker-engine, though. Could you have a look at my master branch at:
http://github.com/paralin/buildroot
And rebase?
I've updated Docker to the latest v1.12-rc2 which has a lot of breaking changes,
so it might require some additional work from your end (sorry!)
Best, Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160627/b542d912/attachment.html>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-06-27 23:02               ` Christian Stewart
@ 2016-06-28 15:21                 ` Andrew Webster
  2016-06-28 17:20                   ` Christian Stewart
  0 siblings, 1 reply; 22+ messages in thread
From: Andrew Webster @ 2016-06-28 15:21 UTC (permalink / raw)
  To: buildroot

> From: Christian Stewart [mailto:christian at paral.in] 
> Sent: Monday, June 27, 2016 7:02 PM

> On Tue, Jun 7, 2016 at 1:18 PM Andrew Webster <Awebster@arcx.com> wrote:
> >?Here is a patch with the init file I used.? I copied the contrib/init/sysvinit-debian/docker file and modified it slightly.

> Thank you again for this patch. It doesn't apply to my latest version of docker-engine, though. Could you have a look at my master branch at:
> http://github.com/paralin/buildroot
> And rebase?

Patch applied cleanly to your master branch.  I also have an additional patch to clean up the "restart".  It may be better if I send the patches using send-email, but I don't want to CC buildroot or they will end up in patchwork.
I can send directly to you instead.

> I've updated Docker to the latest v1.12-rc2 which has a lot of breaking changes, so it might require some additional work from your end (sorry!)

I haven't yet tried to build/run yet, and may not have a chance for a few days.  Would you rather wait until I try it out before I send you patches?

Andrew

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-06-28 15:21                 ` Andrew Webster
@ 2016-06-28 17:20                   ` Christian Stewart
  0 siblings, 0 replies; 22+ messages in thread
From: Christian Stewart @ 2016-06-28 17:20 UTC (permalink / raw)
  To: buildroot

Hey Andrew,
On Tue, Jun 28, 2016 8:21 AM, Andrew Webster Awebster at arcx.com wrote:

Patch applied cleanly to your master branch. I also have an additional patch to
clean up the ?restart?. It may be better if I send the patches using send-email,
but I don't want to CC buildroot or they will end up in patchwork.


I can send directly to you instead.

Sounds good to me. Awaiting your patch.


> I've updated Docker to the latest v1.12-rc2 which has a lot of breaking
changes, so it might require some additional work from your end (sorry!)






I haven't yet tried to build/run yet, and may not have a chance for a few days.
Would you rather wait until I try it out before I send you patches?




1.12 is working great now on my end. I think the only change you will need is to
add a ?d? to docker because they've renamed the daemon from ?docker daemon? to
just ?dockerd? by splitting it into a separate executable.
Also, they've added a lot of journald integrations and such, might be
interesting to see if we can get those working.
best, Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160628/d5548558/attachment.html>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 3/3] docker-engine: " Christian Stewart
  2016-06-07 19:43   ` Andrew Webster
@ 2016-07-04 16:13   ` Romain Naour
  2016-07-04 16:16     ` Christian Stewart
  1 sibling, 1 reply; 22+ messages in thread
From: Romain Naour @ 2016-07-04 16:13 UTC (permalink / raw)
  To: buildroot

Hi Christian,

Le 29/05/2016 ? 00:46, Christian Stewart a ?crit :
> Docker is a platform to build, ship, and run applications in portable
> containers.
> 
> Signed-off-by: Christian Stewart <christian@paral.in>
> 
> ---
> 
> Changes since v1:
>  - use call github to build source URL
> Changes since v3:
>  - fix help indentation in Config.in
>  - use HOST_GO_TARGET_ENV as a base for build env vars
>  - cleanup build commands
>  - cleanup GOPATH and vendor directory setup
>  - Remove selections for graph drivers. Docker will gracefully degrade
>    at runtime to the best available graphdriver. It is unnecessary to
>    disable these at build time, or to pull in any other dependencies
>    like aufs-util or btrfs tools. The daemon will use whatever is
>    available at runtime.
> Changes since v4:
>  - remove commit hash from version scheme
> Changes since v5:
>  - re-introduce graphdriver selections
>  - these selections are required for btrfs and devicemapper
>  - there are buildtime dependencies on headers.
>  - add BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS dep to threading comment
> 
> ---
>  package/Config.in                        |  1 +
>  package/docker-engine/Config.in          | 69 ++++++++++++++++++++++
>  package/docker-engine/docker-engine.hash |  2 +
>  package/docker-engine/docker-engine.mk   | 99 ++++++++++++++++++++++++++++++++
>  4 files changed, 171 insertions(+)
>  create mode 100644 package/docker-engine/Config.in
>  create mode 100644 package/docker-engine/docker-engine.hash
>  create mode 100644 package/docker-engine/docker-engine.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index c8365f8..b829075 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1632,6 +1632,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
>  	source "package/debianutils/Config.in"
>  endif
>  	source "package/docker-containerd/Config.in"
> +	source "package/docker-engine/Config.in"
>  	source "package/cgroupfs-mount/Config.in"
>  	source "package/dsp-tools/Config.in"
>  	source "package/emlog/Config.in"
> diff --git a/package/docker-engine/Config.in b/package/docker-engine/Config.in
> new file mode 100644
> index 0000000..bbf56b1
> --- /dev/null
> +++ b/package/docker-engine/Config.in
> @@ -0,0 +1,69 @@
> +config BR2_PACKAGE_DOCKER_ENGINE
> +	bool "docker-engine"
> +	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
> +	depends on BR2_TOOLCHAIN_HAS_THREADS
> +	depends on BR2_USE_MMU # util-linux
> +	depends on BR2_USE_WCHAR # util-linux
> +	select BR2_PACKAGE_DOCKER_CONTAINERD
> +	select BR2_PACKAGE_RUNC
> +	select BR2_PACKAGE_SQLITE
> +	select BR2_PACKAGE_UTIL_LINUX
> +	select BR2_PACKAGE_UTIL_LINUX_BINARIES
> +	select BR2_PACKAGE_UTIL_LINUX_PIVOT_ROOT
> +	select BR2_PACKAGE_UTIL_LINUX_MOUNTPOINT
> +	select BR2_PACKAGE_UTIL_LINUX_MOUNT
> +	help
> +	  Docker is a platform to build, ship,
> +	  and run applications as lightweight containers.
> +
> +	  https://github.com/docker/docker
> +
> +comment "docker-engine needs a toolchain w/ threads"
> +	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
> +	depends on !BR2_TOOLCHAIN_HAS_THREADS
> +
> +if BR2_PACKAGE_DOCKER_ENGINE
> +
> +config BR2_PACKAGE_DOCKER_ENGINE_DAEMON
> +	bool "docker daemon"
> +	default y
> +	help
> +	  Build the Docker system daemon.
> +	  If not selected, will build client only.
> +
> +config BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL
> +	bool "build experimental features"
> +
> +if BR2_PACKAGE_DOCKER_ENGINE_DAEMON
> +
> +config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS
> +	bool "btrfs filesystem driver"
> +	depends on BR2_USE_WCHAR # btrfs-progs
> +	depends on BR2_USE_MMU # btrfs-progs
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # btrfs-progs
> +	select BR2_PACKAGE_BTRFS_PROGS
> +	help
> +	  Build the btrfs filesystem driver for Docker.
> +
> +config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_DEVICEMAPPER
> +	bool "devicemapper filesystem driver"
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # lvm2
> +	depends on BR2_USE_MMU # lvm2
> +	depends on !BR2_STATIC_LIBS # lvm2
> +	select BR2_PACKAGE_LVM2
> +	select BR2_PACKAGE_LVM2_APP_LIBRARY
> +	help
> +	  Build the devicemapper filesystem driver for Docker.
> +
> +config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS
> +	bool "vfs filesystem driver"
> +	depends on BR2_USE_WCHAR # gvfs
> +	depends on BR2_USE_MMU # gvfs
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # gvfs
> +	select BR2_PACKAGE_GVFS
> +	help
> +	  Build the vfs filesystem driver for Docker.
> +
> +endif
> +
> +endif
> diff --git a/package/docker-engine/docker-engine.hash b/package/docker-engine/docker-engine.hash
> new file mode 100644
> index 0000000..7b93669
> --- /dev/null
> +++ b/package/docker-engine/docker-engine.hash
> @@ -0,0 +1,2 @@
> +# Locally calculated
> +sha256 04de3750738b6f888f03520fb67db22e95e8a8e016ae901428e6c5791c9841cc  docker-engine-v1.11.1.tar.gz
> diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk
> new file mode 100644
> index 0000000..b7407b2
> --- /dev/null
> +++ b/package/docker-engine/docker-engine.mk
> @@ -0,0 +1,99 @@
> +################################################################################
> +#
> +# docker-engine
> +#
> +################################################################################
> +
> +DOCKER_ENGINE_VERSION = v1.11.1
> +DOCKER_ENGINE_SITE = $(call github,docker,docker,$(DOCKER_ENGINE_VERSION))
> +
> +DOCKER_ENGINE_LICENSE = Apache-2.0
> +DOCKER_ENGINE_LICENSE_FILES = LICENSE
> +
> +DOCKER_ENGINE_DEPENDENCIES = host-go docker-containerd
> +
> +DOCKER_ENGINE_GOPATH = "$(@D)/vendor"
> +DOCKER_ENGINE_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
> +	CGO_ENABLED=1 \
> +	CGO_NO_EMULATION=1 \
> +	GOBIN="$(@D)/bin" \
> +	GOPATH="$(DOCKER_ENGINE_GOPATH)"
> +
> +DOCKER_ENGINE_GLDFLAGS = \
> +	-X main.GitCommit=$(DOCKER_ENGINE_VERSION) \
> +	-X main.Version=$(DOCKER_ENGINE_VERSION) \
> +	-extldflags '-static'
> +
> +DOCKER_ENGINE_BUILD_TAGS = cgo exclude_graphdriver_zfs
> +
> +ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
> +DOCKER_ENGINE_BUILD_TAGS += seccomp
> +DOCKER_ENGINE_DEPENDENCIES += libseccomp
> +endif
> +
> +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y)
> +DOCKER_ENGINE_BUILD_TAGS += daemon
> +endif
> +
> +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL),y)
> +DOCKER_ENGINE_BUILD_TAGS += experimental
> +endif
> +
> +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS),y)
> +DOCKER_ENGINE_DEPENDENCIES += btrfs-progs
> +else
> +DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_btrfs
> +endif
> +
> +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_DEVICEMAPPER),y)
> +DOCKER_ENGINE_DEPENDENCIES += lvm2
> +else
> +DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_devicemapper
> +endif
> +
> +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS),y)
> +DOCKER_ENGINE_DEPENDENCIES += gvfs
> +else
> +DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_vfs
> +endif
> +
> +define DOCKER_ENGINE_CONFIGURE_CMDS
> +	$(SED) '/^clean$$/d' $(@D)/hack/vendor.sh
> +	cd $(@D) && bash ./hack/vendor.sh

This script clone dozen git repository

github.com/Azure/go-ansiterm
github.com/Microsoft/hcsshim
github.com/Microsoft/go-winio
github.com/Sirupsen/logrus
github.com/docker/libtrust
github.com/go-check/check
github.com/gorilla/context
github.com/gorilla/mux
github.com/kr/pty
github.com/mattn/go-shellwords
github.com/mattn/go-sqlite3
github.com/mistifyio/go-zfs
github.com/tchap/go-patricia
github.com/vdemeester/shakers
golang.org/x/net
golang.org/x/sys
github.com/docker/go-units
github.com/docker/go-connections
github.com/docker/engine-api
github.com/RackSec/srslog
github.com/imdario/mergo
github.com/docker/libnetwork
github.com/armon/go-metrics
github.com/hashicorp/go-msgpack
github.com/hashicorp/memberlist
github.com/hashicorp/serf
github.com/docker/libkv
github.com/vishvananda/netns
github.com/vishvananda/netlink
github.com/BurntSushi/toml
github.com/samuel/go-zookeeper
github.com/deckarep/golang-set
github.com/coreos/etcd
github.com/ugorji/go
github.com/hashicorp/consul
github.com/boltdb/bolt
github.com/miekg/dns
github.com/docker/distribution
github.com/vbatts/tar-split
github.com/docker/notary
google.golang.org/grpc
github.com/miekg/pkcs11
github.com/docker/go
github.com/agl/ed25519
github.com/opencontainers/runc
github.com/opencontainers/specs
github.com/seccomp/libseccomp-golang
github.com/coreos/go-systemd
github.com/godbus/dbus
github.com/syndtr/gocapability
github.com/golang/protobuf
github.com/Graylog2/go-gelf
github.com/fluent/fluent-logger-golang
github.com/philhofer/fwd
github.com/tinylib/msgp
gopkg.in/fsnotify.v1
github.com/aws/aws-sdk-go
github.com/vaughan0/go-ini
golang.org/x/oauth2
google.golang.org/api
google.golang.org/cloud
github.com/docker/containerd

You probably needs to add theses packages to Buildroot first and then fix
docker-engine build system.

Best regards,
Romain

> +	mkdir -p $(DOCKER_ENGINE_GOPATH)/src/github.com/docker
> +	ln -fs $(@D) $(DOCKER_ENGINE_GOPATH)/src/github.com/docker/docker
> +	ln -fs $(DOCKER_CONTAINERD_SRCDIR) $(DOCKER_ENGINE_GOPATH)/src/github.com/docker/containerd
> +	mkdir -p $(DOCKER_ENGINE_GOPATH)/src/github.com/opencontainers
> +	ln -fs $(RUNC_SRCDIR) $(DOCKER_ENGINE_GOPATH)/src/github.com/opencontainers/runc
> +endef
> +
> +define DOCKER_ENGINE_BUILD_CMDS
> +	cd $(@D); $(DOCKER_ENGINE_MAKE_ENV) $(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/docker -tags "$(DOCKER_ENGINE_BUILD_TAGS)" -ldflags "$(DOCKER_ENGINE_GLDFLAGS)" ./docker
> +endef
> +
> +define DOCKER_ENGINE_INSTALL_TARGET_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/bin/docker $(TARGET_DIR)/usr/bin/docker
> +endef
> +
> +define DOCKER_ENGINE_INSTALL_INIT_SYSTEMD
> +	$(INSTALL) -D -m 0644 $(@D)/contrib/init/systemd/docker.service \
> +		$(TARGET_DIR)/usr/lib/systemd/system/docker.service
> +	$(INSTALL) -D -m 0644 $(@D)/contrib/init/systemd/docker.socket \
> +		$(TARGET_DIR)/usr/lib/systemd/system/docker.socket
> +	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/
> +	ln -fs ../../../../usr/lib/systemd/system/docker.service \
> +		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/docker.service
> +endef
> +
> +define DOCKER_ENGINE_INSTALL_INIT_SYSV
> +	$(INSTALL) -D -m 755 $(@D)/contrib/init/sysvinit-redhat/docker \
> +		$(TARGET_DIR)/etc/init.d/S61docker
> +	$(INSTALL) -D -m 644 $(@D)/contrib/init/sysvinit-redhat/docker.sysconfig \
> +		$(TARGET_DIR)/etc/sysconfig/docker.sysconfig
> +endef
> +
> +define DOCKER_ENGINE_USERS
> +	- - docker -1 * - - - Docker Application Container Framework
> +endef
> +
> +$(eval $(generic-package))
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-07-04 16:13   ` Romain Naour
@ 2016-07-04 16:16     ` Christian Stewart
  2016-07-04 17:45       ` Romain Naour
  0 siblings, 1 reply; 22+ messages in thread
From: Christian Stewart @ 2016-07-04 16:16 UTC (permalink / raw)
  To: buildroot

Romain,

On Mon, Jul 4, 2016, 9:13 AM Romain Naour <romain.naour@gmail.com> wrote:

> This script clone dozen git repository
>

That script is unnecessary and I have removed it in my newer version of
this series. It's intended to be called by developers to update the vendor
tree, not at build time.

Christian

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160704/ac5a51a7/attachment.html>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 1/3] runc: new package
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 1/3] runc: new package Christian Stewart
@ 2016-07-04 16:29   ` Romain Naour
  0 siblings, 0 replies; 22+ messages in thread
From: Romain Naour @ 2016-07-04 16:29 UTC (permalink / raw)
  To: buildroot

Hi Christian,

Le 29/05/2016 ? 00:46, Christian Stewart a ?crit :
> runC is a CLI tool for spawning and running containers according to the
> OCP specification.
> 
> runC is used by the latest Docker engine versions, however, runc itself
> is standalone and has no other dependencies.
> 
> https://runc.io/
> 
> Signed-off-by: Christian Stewart <christian@paral.in>

Verified License and License file, build test.

Reviewed-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain


> 
> ---
> 
> Changes since v1:
>  - use call github to generate source url
> Changes since v3:
>  - fix indentation in Config.in
>  - add dep on threads in Config.in
>  - break gopath into separate variable
>  - use HOST_GO_TARGET_ENV
> Changes since v4:
>  - use RUNC_VERSION instead of commit hash
>  - only show comment when build is possible with threads enabled
> 
> ---
>  package/Config.in      |  1 +
>  package/runc/Config.in | 13 +++++++++++++
>  package/runc/runc.hash |  2 ++
>  package/runc/runc.mk   | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 62 insertions(+)
>  create mode 100644 package/runc/Config.in
>  create mode 100644 package/runc/runc.hash
>  create mode 100644 package/runc/runc.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index 9d668bf..6c513ba 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1664,6 +1664,7 @@ endif
>  if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
>  	source "package/rsyslog/Config.in"
>  endif
> +	source "package/runc/Config.in"
>  	source "package/scrub/Config.in"
>  	source "package/scrypt/Config.in"
>  	source "package/smack/Config.in"
> diff --git a/package/runc/Config.in b/package/runc/Config.in
> new file mode 100644
> index 0000000..1802e59
> --- /dev/null
> +++ b/package/runc/Config.in
> @@ -0,0 +1,13 @@
> +config BR2_PACKAGE_RUNC
> +	bool "runc"
> +	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
> +	depends on BR2_TOOLCHAIN_HAS_THREADS
> +	help
> +	  runC is a CLI tool for spawning and running containers
> +	  according to the OCP specification.
> +
> +	  https://github.com/opencontainers/runc
> +
> +comment "runc needs a toolchain w/ threads"
> +	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
> +	depends on !BR2_TOOLCHAIN_HAS_THREADS
> diff --git a/package/runc/runc.hash b/package/runc/runc.hash
> new file mode 100644
> index 0000000..c109c33
> --- /dev/null
> +++ b/package/runc/runc.hash
> @@ -0,0 +1,2 @@
> +# Locally computed
> +sha256 f9955daed1e73e842b2f28a258fba51f4e72a6b4b64cc3fc06415481d55ce000  runc-v0.1.1.tar.gz
> diff --git a/package/runc/runc.mk b/package/runc/runc.mk
> new file mode 100644
> index 0000000..72b194d
> --- /dev/null
> +++ b/package/runc/runc.mk
> @@ -0,0 +1,46 @@
> +################################################################################
> +#
> +# runc
> +#
> +################################################################################
> +
> +RUNC_VERSION = v0.1.1
> +RUNC_SITE = $(call github,opencontainers,runc,$(RUNC_VERSION))
> +
> +RUNC_LICENSE = Apache-2.0
> +RUNC_LICENSE_FILES = LICENSE
> +
> +RUNC_DEPENDENCIES = host-go
> +
> +RUNC_GOPATH = "$(@D)/Godeps/_workspace"
> +RUNC_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
> +	CGO_ENABLED=1 \
> +	GOBIN="$(@D)/bin" \
> +	GOPATH="$(RUNC_GOPATH)"
> +
> +RUNC_GLDFLAGS = \
> +	-X main.gitCommit=$(RUNC_VERSION) \
> +	-extldflags '-static'
> +
> +RUNC_GOTAGS = cgo static_build
> +
> +ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
> +RUNC_GOTAGS += seccomp
> +RUNC_DEPENDENCIES += libseccomp
> +endif
> +
> +define RUNC_CONFIGURE_CMDS
> +	mkdir -p $(RUNC_GOPATH)/src/github.com/opencontainers
> +	ln -s $(@D) $(RUNC_GOPATH)/src/github.com/opencontainers/runc
> +endef
> +
> +define RUNC_BUILD_CMDS
> +	cd $(@D) && $(RUNC_MAKE_ENV) $(HOST_DIR)/usr/bin/go \
> +		build -v -o $(@D)/bin/runc -tags "$(RUNC_GOTAGS)" -ldflags "$(RUNC_GLDFLAGS)" .
> +endef
> +
> +define RUNC_INSTALL_TARGET_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/bin/runc $(TARGET_DIR)/usr/bin/runc
> +endef
> +
> +$(eval $(generic-package))
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 2/3] docker-containerd: new package
  2016-05-28 22:46 ` [Buildroot] [PATCH v6 2/3] docker-containerd: " Christian Stewart
  2016-06-07 20:15   ` Andrew Webster
@ 2016-07-04 17:43   ` Romain Naour
  1 sibling, 0 replies; 22+ messages in thread
From: Romain Naour @ 2016-07-04 17:43 UTC (permalink / raw)
  To: buildroot

Hi Christian,

Le 29/05/2016 ? 00:46, Christian Stewart a ?crit :
> docker-containerd is a daemon and API for controlling and managing runC
> containers.
> 
> https://containerd.tools/
> 
> Signed-off-by: Christian Stewart <christian@paral.in>
> 
> ---
> 
> Changes since v3:
>  - Don't depend on runc at compile-time
>  - Add threading dependency
>  - Use HOST_GO_TARGET_ENV, partially
>  - Cleanup compile commands
>  - Include patch to fix arm64 compilation
> Changes since v4:
>  - Bump to v0.2.2
>  - update hash for 0.2.2
>  - fix docker-runc simlink
>  - use CONTAINERD_VERSION for GitCommit const
>  - add go arch supports to config.in comment
>  - did runtime tests
>  - added signed-off-by to the patch series
> 
> ---
>  package/Config.in                                |   1 +
>  package/docker-containerd/0001-arm64-fixes.patch | 189 +++++++++++++++++++++++
>  package/docker-containerd/Config.in              |  13 ++
>  package/docker-containerd/docker-containerd.hash |   2 +
>  package/docker-containerd/docker-containerd.mk   |  44 ++++++
>  5 files changed, 249 insertions(+)
>  create mode 100644 package/docker-containerd/0001-arm64-fixes.patch
>  create mode 100644 package/docker-containerd/Config.in
>  create mode 100644 package/docker-containerd/docker-containerd.hash
>  create mode 100644 package/docker-containerd/docker-containerd.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index 6c513ba..c8365f8 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1631,6 +1631,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
>  	source "package/dcron/Config.in"
>  	source "package/debianutils/Config.in"
>  endif
> +	source "package/docker-containerd/Config.in"
>  	source "package/cgroupfs-mount/Config.in"
>  	source "package/dsp-tools/Config.in"
>  	source "package/emlog/Config.in"
> diff --git a/package/docker-containerd/0001-arm64-fixes.patch b/package/docker-containerd/0001-arm64-fixes.patch
> new file mode 100644
> index 0000000..19df02c
> --- /dev/null
> +++ b/package/docker-containerd/0001-arm64-fixes.patch
> @@ -0,0 +1,189 @@
> +From f6f54370d154b0ce5f35319d878048d7db8db89c Mon Sep 17 00:00:00 2001
> +From: Lei Jitang <leijitang@huawei.com>
> +Date: Tue, 5 Apr 2016 23:17:30 -0400
> +Subject: [PATCH] arm64 fixes
> +
> +This commit is a combination of a few cherry-picked commits from the
> +current master (0.3.0 candidate) of docker-containerd, which
> +specifically address issues under arm64.

It would be good to not squash several patches into one. It would be easier to
rework the patch during a version bump.

> +
> +move epoll syscall to arch specific to enable containerd run on arm64
> +Rename epoll_amd64.go to epoll.go
> +Signed-off-by: Lei Jitang <leijitang@huawei.com>
> +
> +archutils: epoll_aarch64: fix C formatting
> +Signed-off-by: Aleksa Sarai <asarai@suse.de>
> +
> +archutils: fix build on aarch64
> +Signed-off-by: Aleksa Sarai <asarai@suse.de>
> +
> +Use flag for aarch64 EpollCreate1
> +Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
> +
> +Correct build flag for arm64
> +Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
> +
> +Series signature:
> +
> +Signed-off-by: Christian Stewart <christian@paral.in>
> +
> +---
> + archutils/epoll.go          | 19 ++++++++++++
> + archutils/epoll_arm64.go    | 70 +++++++++++++++++++++++++++++++++++++++++++++
> + supervisor/monitor_linux.go |  9 +++---
> + 3 files changed, 94 insertions(+), 4 deletions(-)
> + create mode 100644 archutils/epoll.go
> + create mode 100644 archutils/epoll_arm64.go
> +
> +diff --git a/archutils/epoll.go b/archutils/epoll.go
> +new file mode 100644
> +index 0000000..c8ade64
> +--- /dev/null
> ++++ b/archutils/epoll.go
> +@@ -0,0 +1,19 @@
> ++// +build linux,!arm64
> ++
> ++package archutils
> ++
> ++import (
> ++	"syscall"
> ++)
> ++
> ++func EpollCreate1(flag int) (int, error) {
> ++	return syscall.EpollCreate1(flag)
> ++}
> ++
> ++func EpollCtl(epfd int, op int, fd int, event *syscall.EpollEvent) error {
> ++	return syscall.EpollCtl(epfd, op, fd, event)
> ++}
> ++
> ++func EpollWait(epfd int, events []syscall.EpollEvent, msec int) (int, error) {
> ++	return syscall.EpollWait(epfd, events, msec)
> ++}
> +diff --git a/archutils/epoll_arm64.go b/archutils/epoll_arm64.go
> +new file mode 100644
> +index 0000000..00abc68
> +--- /dev/null
> ++++ b/archutils/epoll_arm64.go
> +@@ -0,0 +1,70 @@
> ++// +build linux,arm64
> ++
> ++package archutils
> ++
> ++// #include <sys/epoll.h>
> ++/*
> ++int EpollCreate1(int flag) {
> ++	return epoll_create1(flag);
> ++}
> ++
> ++int EpollCtl(int efd, int op,int sfd, int events, int fd) {
> ++	struct epoll_event event;
> ++	event.events = events;
> ++	event.data.fd = fd;
> ++
> ++	return epoll_ctl(efd, op, sfd, &event);
> ++}
> ++
> ++struct event_t {
> ++	uint32_t events;
> ++	int fd;
> ++};
> ++
> ++struct epoll_event events[128];
> ++int run_epoll_wait(int fd, struct event_t *event) {
> ++	int n, i;
> ++	n = epoll_wait(fd, events, 128, -1);
> ++	for (i = 0; i < n; i++) {
> ++		event[i].events = events[i].events;
> ++		event[i].fd = events[i].data.fd;
> ++	}
> ++	return n;
> ++}
> ++*/
> ++import "C"
> ++
> ++import (
> ++	"fmt"
> ++	"syscall"
> ++	"unsafe"
> ++)
> ++
> ++func EpollCreate1(flag int) (int, error) {
> ++	fd := int(C.EpollCreate1(C.int(flag)))
> ++	if fd < 0 {
> ++		return fd, fmt.Errorf("failed to create epoll, errno is %d", fd)
> ++	}
> ++	return fd, nil
> ++}
> ++
> ++func EpollCtl(epfd int, op int, fd int, event *syscall.EpollEvent) error {
> ++	errno := C.EpollCtl(C.int(epfd), C.int(syscall.EPOLL_CTL_ADD), C.int(fd), C.int(event.Events), C.int(event.Fd))
> ++	if errno < 0 {
> ++		return fmt.Errorf("Failed to ctl epoll")
> ++	}
> ++	return nil
> ++}
> ++
> ++func EpollWait(epfd int, events []syscall.EpollEvent, msec int) (int, error) {
> ++	var c_events [128]C.struct_event_t
> ++	n := int(C.run_epoll_wait(C.int(epfd), (*C.struct_event_t)(unsafe.Pointer(&c_events))))
> ++	if n < 0 {
> ++		return int(n), fmt.Errorf("Failed to wait epoll")
> ++	}
> ++	for i := 0; i < n; i++ {
> ++		events[i].Fd = int32(c_events[i].fd)
> ++		events[i].Events = uint32(c_events[i].events)
> ++	}
> ++	return int(n), nil
> ++}
> +diff --git a/supervisor/monitor_linux.go b/supervisor/monitor_linux.go
> +index adf4ffd..b176585 100644
> +--- a/supervisor/monitor_linux.go
> ++++ b/supervisor/monitor_linux.go
> +@@ -5,6 +5,7 @@ import (
> + 	"syscall"
> + 
> + 	"github.com/Sirupsen/logrus"
> ++	"github.com/docker/containerd/archutils"
> + 	"github.com/docker/containerd/runtime"
> + )
> + 
> +@@ -14,7 +15,7 @@ func NewMonitor() (*Monitor, error) {
> + 		exits:     make(chan runtime.Process, 1024),
> + 		ooms:      make(chan string, 1024),
> + 	}
> +-	fd, err := syscall.EpollCreate1(0)
> ++	fd, err := archutils.EpollCreate1(0)
> + 	if err != nil {
> + 		return nil, err
> + 	}
> +@@ -47,7 +48,7 @@ func (m *Monitor) Monitor(p runtime.Process) error {
> + 		Fd:     int32(fd),
> + 		Events: syscall.EPOLLHUP,
> + 	}
> +-	if err := syscall.EpollCtl(m.epollFd, syscall.EPOLL_CTL_ADD, fd, &event); err != nil {
> ++	if err := archutils.EpollCtl(m.epollFd, syscall.EPOLL_CTL_ADD, fd, &event); err != nil {
> + 		return err
> + 	}
> + 	EpollFdCounter.Inc(1)
> +@@ -67,7 +68,7 @@ func (m *Monitor) MonitorOOM(c runtime.Container) error {
> + 		Fd:     int32(fd),
> + 		Events: syscall.EPOLLHUP | syscall.EPOLLIN,
> + 	}
> +-	if err := syscall.EpollCtl(m.epollFd, syscall.EPOLL_CTL_ADD, fd, &event); err != nil {
> ++	if err := archutils.EpollCtl(m.epollFd, syscall.EPOLL_CTL_ADD, fd, &event); err != nil {
> + 		return err
> + 	}
> + 	EpollFdCounter.Inc(1)
> +@@ -82,7 +83,7 @@ func (m *Monitor) Close() error {
> + func (m *Monitor) start() {
> + 	var events [128]syscall.EpollEvent
> + 	for {
> +-		n, err := syscall.EpollWait(m.epollFd, events[:], -1)
> ++		n, err := archutils.EpollWait(m.epollFd, events[:], -1)
> + 		if err != nil {
> + 			if err == syscall.EINTR {
> + 				continue
> +-- 
> +2.7.3
> +
> diff --git a/package/docker-containerd/Config.in b/package/docker-containerd/Config.in
> new file mode 100644
> index 0000000..e76a6a2
> --- /dev/null
> +++ b/package/docker-containerd/Config.in
> @@ -0,0 +1,13 @@
> +config BR2_PACKAGE_DOCKER_CONTAINERD
> +	bool "docker-containerd"
> +	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
> +	depends on BR2_TOOLCHAIN_HAS_THREADS
> +	select BR2_PACKAGE_RUNC

Please, add a comment to say that runc is a runtime dependency.

Best regards,
Romain


> +	help
> +	  containerd is a daemon to control runC.
> +
> +	  https://github.com/docker/containerd
> +
> +comment "docker-containerd needs a toolchain w/ threads"
> +	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
> +	depends on !BR2_TOOLCHAIN_HAS_THREADS
> diff --git a/package/docker-containerd/docker-containerd.hash b/package/docker-containerd/docker-containerd.hash
> new file mode 100644
> index 0000000..b98e651
> --- /dev/null
> +++ b/package/docker-containerd/docker-containerd.hash
> @@ -0,0 +1,2 @@
> +# Computed locally
> +sha256 a21efc7ea4bb97306ae9807caadca6782358679f38d3afd606cb599b6853bc52  docker-containerd-v0.2.2.tar.gz
> diff --git a/package/docker-containerd/docker-containerd.mk b/package/docker-containerd/docker-containerd.mk
> new file mode 100644
> index 0000000..902d63f
> --- /dev/null
> +++ b/package/docker-containerd/docker-containerd.mk
> @@ -0,0 +1,44 @@
> +################################################################################
> +#
> +# docker-containerd
> +#
> +################################################################################
> +
> +DOCKER_CONTAINERD_VERSION = v0.2.2
> +DOCKER_CONTAINERD_SITE = $(call github,docker,containerd,$(DOCKER_CONTAINERD_VERSION))
> +
> +DOCKER_CONTAINERD_LICENSE = Apache-2.0
> +DOCKER_CONTAINERD_LICENSE_FILES = LICENSE.code
> +
> +DOCKER_CONTAINERD_DEPENDENCIES = host-go
> +
> +DOCKER_CONTAINERD_GOPATH = "$(@D)/vendor"
> +DOCKER_CONTAINERD_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
> +	CGO_ENABLED=1 \
> +	GOBIN="$(@D)/bin" \
> +	GOPATH="$(DOCKER_CONTAINERD_GOPATH)"
> +
> +DOCKER_CONTAINERD_GLDFLAGS = \
> +	-X github.com/docker/containerd.GitCommit=$(DOCKER_CONTAINERD_VERSION) \
> +	-extldflags '-static'
> +
> +define DOCKER_CONTAINERD_CONFIGURE_CMDS
> +	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker
> +	ln -s $(@D) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/docker/containerd
> +	mkdir -p $(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers
> +	ln -s $(RUNC_SRCDIR) $(DOCKER_CONTAINERD_GOPATH)/src/github.com/opencontainers/runc
> +endef
> +
> +define DOCKER_CONTAINERD_BUILD_CMDS
> +	cd $(@D); $(DOCKER_CONTAINERD_MAKE_ENV) $(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/ctr -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./ctr
> +	cd $(@D); $(DOCKER_CONTAINERD_MAKE_ENV) $(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/containerd -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./containerd
> +	cd $(@D); $(DOCKER_CONTAINERD_MAKE_ENV) $(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/containerd-shim -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./containerd-shim
> +endef
> +
> +define DOCKER_CONTAINERD_INSTALL_TARGET_CMDS
> +	ln -fs runc $(TARGET_DIR)/usr/bin/docker-runc
> +	$(INSTALL) -D -m 0755 $(@D)/bin/containerd $(TARGET_DIR)/usr/bin/docker-containerd
> +	$(INSTALL) -D -m 0755 $(@D)/bin/containerd-shim $(TARGET_DIR)/usr/bin/containerd-shim
> +endef
> +
> +$(eval $(generic-package))
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v6 3/3] docker-engine: new package
  2016-07-04 16:16     ` Christian Stewart
@ 2016-07-04 17:45       ` Romain Naour
  0 siblings, 0 replies; 22+ messages in thread
From: Romain Naour @ 2016-07-04 17:45 UTC (permalink / raw)
  To: buildroot

Le 04/07/2016 ? 18:16, Christian Stewart a ?crit :
> Romain,
> 
> On Mon, Jul 4, 2016, 9:13 AM Romain Naour <romain.naour@gmail.com
> <mailto:romain.naour@gmail.com>> wrote:
> 
>     This script clone dozen git repository
> 
> 
> That script is unnecessary and I have removed it in my newer version of this
> series. It's intended to be called by developers to update the vendor tree, not
> at build time. 

Ok, great. You had some review on patch 2 and 3, I'll mark the series changes
requested in the patchwork. Please, don't forget to send an updated version.

Thanks!

Best regards,
Romain


> 
> Christian 
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-07-04 17:45 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-28 22:46 [Buildroot] [PATCH v6 0/3] Add docker engine support Christian Stewart
2016-05-28 22:46 ` [Buildroot] [PATCH v6 1/3] runc: new package Christian Stewart
2016-07-04 16:29   ` Romain Naour
2016-05-28 22:46 ` [Buildroot] [PATCH v6 2/3] docker-containerd: " Christian Stewart
2016-06-07 20:15   ` Andrew Webster
2016-06-07 20:24     ` Christian Stewart
2016-07-04 17:43   ` Romain Naour
2016-05-28 22:46 ` [Buildroot] [PATCH v6 3/3] docker-engine: " Christian Stewart
2016-06-07 19:43   ` Andrew Webster
2016-06-07 19:54     ` Thomas Petazzoni
2016-06-07 20:10       ` Andrew Webster
2016-06-07 20:18       ` Christian Stewart
2016-06-07 20:37         ` Andrew Webster
2016-06-07 20:47           ` Thomas Petazzoni
2016-06-08 15:29             ` Andrew Webster
2016-06-27 23:02               ` Christian Stewart
2016-06-28 15:21                 ` Andrew Webster
2016-06-28 17:20                   ` Christian Stewart
2016-07-04 16:13   ` Romain Naour
2016-07-04 16:16     ` Christian Stewart
2016-07-04 17:45       ` Romain Naour
2016-06-27 22:22 ` [Buildroot] [PATCH v6 0/3] Add docker engine support Christian Stewart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.