Skip to contentSkip to conversation

runc: new package

PATCH Superseded Christian Stewart 3 participants 15 messages Jul 4, 2016

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/5 runc: new package

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/

---

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
Changes since v5:
- bump to v1.0.0-rc1

---

---
 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
package/Config.in +1 -0
index 2c4c196..078436e 100644
@@ -1665,6 +1665,7 @@ menu "System tools"
 	source "package/pwgen/Config.in"
 	source "package/quota/Config.in"
 	source "package/rsyslog/Config.in"
+	source "package/runc/Config.in"
 	source "package/scrub/Config.in"
 	source "package/scrypt/Config.in"
 	source "package/smack/Config.in"
package/runc/Config.in new file +13 -0
new file mode 100644
index 0000000..1802e59
@@ -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
package/runc/runc.hash new file +2 -0
new file mode 100644
index 0000000..e6ec483
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 77f9d4df1657fecc939be0261fcccccd34d5b22c02b8a49abad23fac33b4059a  runc-v1.0.0-rc1.tar.gz
package/runc/runc.mk new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.7.3
#1 lore raw

PATCH v6 2/5 docker-containerd: new package

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

https://containerd.tools/

---

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
Changes since v5:
- containerd-shim aliased to docker-containerd-shim
- bumped to 1b3a8154 (commit pin required)
- patches removed (included in bump)

---

---
 package/Config.in                                |  1 +
 package/docker-containerd/Config.in              | 13 +++++++
 package/docker-containerd/docker-containerd.hash |  2 ++
 package/docker-containerd/docker-containerd.mk   | 45 ++++++++++++++++++++++++
 4 files changed, 61 insertions(+)
 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
package/Config.in +1 -0
index 078436e..01c0811 100644
@@ -1636,6 +1636,7 @@ menu "System tools"
 	source "package/cpuload/Config.in"
 	source "package/dcron/Config.in"
 	source "package/debianutils/Config.in"
+	source "package/docker-containerd/Config.in"
 	source "package/cgroupfs-mount/Config.in"
 	source "package/dsp-tools/Config.in"
 	source "package/efibootmgr/Config.in"
package/docker-containerd/Config.in new file +13 -0
new file mode 100644
index 0000000..e76a6a2
@@ -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
package/docker-containerd/docker-containerd.hash new file +2 -0
new file mode 100644
index 0000000..a4a427d
@@ -0,0 +1,2 @@
+# Computed locally
+sha256 bdfa54c94f3de901a7983dc0bc924dd2268e9a5f5fe920d27bfdafad60958522  docker-containerd-1b3a81545ca79456086dc2aa424357be98b962ee.tar.gz
package/docker-containerd/docker-containerd.mk new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.7.3
#2 lore raw

PATCH v6 2/5 docker-containerd: new package

Hi Christian,

Le 04/07/2016 ? 21:26, Christian Stewart a ?crit :

Quoted 59 lines

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

https://containerd.tools/

---

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
Changes since v5:
- containerd-shim aliased to docker-containerd-shim
- bumped to 1b3a8154 (commit pin required)
- patches removed (included in bump)

---

---
 package/Config.in                                |  1 +
 package/docker-containerd/Config.in              | 13 +++++++
 package/docker-containerd/docker-containerd.hash |  2 ++
 package/docker-containerd/docker-containerd.mk   | 45 ++++++++++++++++++++++++
 4 files changed, 61 insertions(+)
 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
package/Config.in +1 -0
index 078436e..01c0811 100644
@@ -1636,6 +1636,7 @@ menu "System tools"
 	source "package/cpuload/Config.in"
 	source "package/dcron/Config.in"
 	source "package/debianutils/Config.in"
+	source "package/docker-containerd/Config.in"
 	source "package/cgroupfs-mount/Config.in"
 	source "package/dsp-tools/Config.in"
 	source "package/efibootmgr/Config.in"
package/docker-containerd/Config.in new file +0 -0
new file mode 100644
index 0000000..e76a6a2

package/docker-containerd/Config.in line 5

Quoted 5 lines
package/docker-containerd/Config.in new file +5 -0
@@ -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

Missing comment about the runtime dependency.

Quoted 54 lines
package/docker-containerd/Config.in new file +8 -0
+	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
package/docker-containerd/docker-containerd.hash new file +2 -0
new file mode 100644
index 0000000..a4a427d
@@ -0,0 +1,2 @@
+# Computed locally
+sha256 bdfa54c94f3de901a7983dc0bc924dd2268e9a5f5fe920d27bfdafad60958522  docker-containerd-1b3a81545ca79456086dc2aa424357be98b962ee.tar.gz
package/docker-containerd/docker-containerd.mk new file +32 -0
new file mode 100644
index 0000000..f0000e6
@@ -0,0 +1,45 @@
+################################################################################
+#
+# docker-containerd
+#
+################################################################################
+
+DOCKER_CONTAINERD_VERSION = 1b3a81545ca79456086dc2aa424357be98b962ee
+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

package/docker-containerd/docker-containerd.mk line 42

Quoted 10 lines
package/docker-containerd/docker-containerd.mk new file +10 -0
+	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
+	ln -fs containerd-shim $(TARGET_DIR)/usr/bin/docker-containerd-shim

Why this "docker-" prefix is required ? (sorry I don't know much docker)

Best regards,
Romain

Quoted 4 lines
package/docker-containerd/docker-containerd.mk new file +3 -0
+endef
+
+$(eval $(generic-package))
#3 lore raw

PATCH v6 2/5 docker-containerd: new package

Romain,

On Mon, Jul 4, 2016 1:13 PM, Romain Naour romain.naour at gmail.com wrote:Missing comment about the runtime dependency.

I swear I added it - must have been lost somewhere in my git tree. Why this ?docker-? prefix is required ? (sorry I don't know much docker)

That's just the name of the project (docker-containerd) and also the name the main docker daemon expects for the executable.
Best, Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160704/585d14bd/attachment.html>

#4 lore raw

PATCH v6 3/5 docker-engine: new package

In reply to Christian Stewart

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

---

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.
- bump to v1.12.0-rc3
- remove hack/vendor.sh call, it is unnecessary, dependencies are pre-vendored into the source tree.

---

---
 package/Config.in                        |   1 +
 package/docker-engine/Config.in          |  69 ++++++++++++++++++
 package/docker-engine/docker-engine.hash |   2 +
 package/docker-engine/docker-engine.mk   | 116 +++++++++++++++++++++++++++++++
 4 files changed, 188 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
package/Config.in +1 -0
index 01c0811..fee59a1 100644
@@ -1637,6 +1637,7 @@ menu "System tools"
 	source "package/dcron/Config.in"
 	source "package/debianutils/Config.in"
 	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/efibootmgr/Config.in"
package/docker-engine/Config.in new file +69 -0

69 lines not on this page · raw message

package/docker-engine/docker-engine.hash new file +2 -0
new file mode 100644
index 0000000..ac90ee6
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 3f030c4f084ed518efeb00f21f3fdfb25252dd9c153b1d42da953e59bb41c582  docker-engine-v1.12.0-rc3.tar.gz
package/docker-engine/docker-engine.mk new file +116 -0

116 lines not on this page · raw message

Signature · 1 line
2.7.3
#5 lore raw

PATCH v6 3/5 docker-engine: new package

Le 04/07/2016 ? 21:26, Christian Stewart a ?crit :

Quoted 225 lines

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

---

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.
- bump to v1.12.0-rc3
- remove hack/vendor.sh call, it is unnecessary, dependencies are pre-vendored into the source tree.

---

---
 package/Config.in                        |   1 +
 package/docker-engine/Config.in          |  69 ++++++++++++++++++
 package/docker-engine/docker-engine.hash |   2 +
 package/docker-engine/docker-engine.mk   | 116 +++++++++++++++++++++++++++++++
 4 files changed, 188 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
package/Config.in +1 -0
index 01c0811..fee59a1 100644
@@ -1637,6 +1637,7 @@ menu "System tools"
 	source "package/dcron/Config.in"
 	source "package/debianutils/Config.in"
 	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/efibootmgr/Config.in"
package/docker-engine/Config.in new file +69 -0
new file mode 100644
index 0000000..bbf56b1
@@ -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
package/docker-engine/docker-engine.hash new file +2 -0
new file mode 100644
index 0000000..ac90ee6
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 3f030c4f084ed518efeb00f21f3fdfb25252dd9c153b1d42da953e59bb41c582  docker-engine-v1.12.0-rc3.tar.gz
package/docker-engine/docker-engine.mk new file +82 -0
new file mode 100644
index 0000000..501afbc
@@ -0,0 +1,116 @@
+################################################################################
+#
+# docker-engine
+#
+################################################################################
+
+DOCKER_ENGINE_VERSION = v1.12.0-rc3
+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 autogen
+
+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
+	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
+	cd $(@D) && \
+		GITCOMMIT="unknown" BUILDTIME="$$(date)" VERSION="$(DOCKER_ENGINE_VERSION)" \
+		bash ./hack/make/.go-autogen
+endef
+
+define DOCKER_ENGINE_BUILD_CLIENT_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)" ./cmd/docker
+endef
+
+define DOCKER_ENGINE_BUILD_DAEMON_CMDS
+	cd $(@D); $(DOCKER_ENGINE_MAKE_ENV) $(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/dockerd -tags "$(DOCKER_ENGINE_BUILD_TAGS)" -ldflags "$(DOCKER_ENGINE_GLDFLAGS)" ./cmd/dockerd
+endef
+
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y)
+define DOCKER_ENGINE_BUILD_CMDS
+	$(DOCKER_ENGINE_BUILD_CLIENT_CMDS)
+	$(DOCKER_ENGINE_BUILD_DAEMON_CMDS)

package/docker-engine/docker-engine.mk line 92

Quoted 10 lines
package/docker-engine/docker-engine.mk new file +10 -0
+endef
+else
+define DOCKER_ENGINE_BUILD_CMDS
+	$(DOCKER_ENGINE_BUILD_CLIENT_CMDS)
+endef
+endif
+
+define DOCKER_ENGINE_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/bin/docker $(TARGET_DIR)/usr/bin/docker
+	$(INSTALL) -D -m 0755 $(@D)/bin/dockerd $(TARGET_DIR)/usr/bin/dockerd
                                    ^

I had an error during install, dockerd needs to be installed only if it is selected by BR2_PACKAGE_DOCKER_ENGINE_DAEMON.

Otherwise:

Best regards,
Romain

Quoted 25 lines
package/docker-engine/docker-engine.mk new file +24 -0
+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))
#6 lore raw

PATCH v6 3/5 docker-engine: new package

Le 04/07/2016 ? 22:27, Romain Naour a ?crit :

Quoted 53 lines

Le 04/07/2016 ? 21:26, Christian Stewart a ?crit :

Quoted 52 lines

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

---

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.
- bump to v1.12.0-rc3
- remove hack/vendor.sh call, it is unnecessary, dependencies are pre-vendored into the source tree.

---

---
 package/Config.in                        |   1 +
 package/docker-engine/Config.in          |  69 ++++++++++++++++++
 package/docker-engine/docker-engine.hash |   2 +
 package/docker-engine/docker-engine.mk   | 116 +++++++++++++++++++++++++++++++
 4 files changed, 188 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
package/Config.in +1 -0
index 01c0811..fee59a1 100644
@@ -1637,6 +1637,7 @@ menu "System tools"
 	source "package/dcron/Config.in"
 	source "package/debianutils/Config.in"
 	source "package/docker-containerd/Config.in"
+	source "package/docker-engine/Config.in"
 	source "package/cgroupfs-mount/Config.in"
Quoted 8 lines

package/docker-engine/Config.in

Quoted 8 lines
package/Config.in +0 -0
 	source "package/dsp-tools/Config.in"
 	source "package/efibootmgr/Config.in"
package/docker-engine/Config.in new file +0 -0
new file mode 100644
index 0000000..bbf56b1
@@ -0,0 +1,69 @@

I have some additional comments:

Quoted 8 lines

package/docker-engine/Config.in line 8

Quoted 8 lines
package/docker-engine/Config.in new file +8 -0
+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

missing comment about the runtime dependency

Quoted 1 line

package/docker-engine/Config.in line 9

Quoted 1 line
package/docker-engine/Config.in new file +1 -0
+	select BR2_PACKAGE_SQLITE

Why sqlite is selected ? runtime dependency ?

Quoted 5 lines

package/docker-engine/Config.in line 14

Quoted 5 lines
package/docker-engine/Config.in new file +5 -0
+	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

runtime dependency probably.

It seems that the busybox version of these tools are not supported by decker-engine init scripts ?

Best regards,
Romain

Quoted 198 lines
Quoted 151 lines
package/docker-engine/Config.in new file +55 -0
+	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
package/docker-engine/docker-engine.hash new file +2 -0
new file mode 100644
index 0000000..ac90ee6
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 3f030c4f084ed518efeb00f21f3fdfb25252dd9c153b1d42da953e59bb41c582  docker-engine-v1.12.0-rc3.tar.gz
package/docker-engine/docker-engine.mk new file +82 -0
new file mode 100644
index 0000000..501afbc
@@ -0,0 +1,116 @@
+################################################################################
+#
+# docker-engine
+#
+################################################################################
+
+DOCKER_ENGINE_VERSION = v1.12.0-rc3
+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 autogen
+
+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
+	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
+	cd $(@D) && \
+		GITCOMMIT="unknown" BUILDTIME="$$(date)" VERSION="$(DOCKER_ENGINE_VERSION)" \
+		bash ./hack/make/.go-autogen
+endef
+
+define DOCKER_ENGINE_BUILD_CLIENT_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)" ./cmd/docker
+endef
+
+define DOCKER_ENGINE_BUILD_DAEMON_CMDS
+	cd $(@D); $(DOCKER_ENGINE_MAKE_ENV) $(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/dockerd -tags "$(DOCKER_ENGINE_BUILD_TAGS)" -ldflags "$(DOCKER_ENGINE_GLDFLAGS)" ./cmd/dockerd
+endef
+
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y)
+define DOCKER_ENGINE_BUILD_CMDS
+	$(DOCKER_ENGINE_BUILD_CLIENT_CMDS)
+	$(DOCKER_ENGINE_BUILD_DAEMON_CMDS)

package/docker-engine/docker-engine.mk line 92

Quoted 10 lines
package/docker-engine/docker-engine.mk new file +10 -0
+endef
+else
+define DOCKER_ENGINE_BUILD_CMDS
+	$(DOCKER_ENGINE_BUILD_CLIENT_CMDS)
+endef
+endif
+
+define DOCKER_ENGINE_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/bin/docker $(TARGET_DIR)/usr/bin/docker
+	$(INSTALL) -D -m 0755 $(@D)/bin/dockerd $(TARGET_DIR)/usr/bin/dockerd
                                    ^

I had an error during install, dockerd needs to be installed only if it is selected by BR2_PACKAGE_DOCKER_ENGINE_DAEMON.

Otherwise:

Best regards,
Romain

Quoted 25 lines
package/docker-engine/docker-engine.mk new file +24 -0
+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))
#7 lore raw

PATCH v6 4/5 package/docker-engine: proper sysv init file

In reply to Christian Stewart

From: Andrew Webster <[email protected]>

The packaged redhat init file is not suitable for buildroot. This adds a customized version for buildroot.

---
 package/docker-engine/docker-engine.mk |   6 +-
 package/docker-engine/docker.init      | 112 +++++++++++++++++++++++++++++++++
 2 files changed, 115 insertions(+), 3 deletions(-)
 create mode 100644 package/docker-engine/docker.init
package/docker-engine/docker-engine.mk +3 -3
index 501afbc..4cb896c 100644
@@ -103,10 +103,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
package/docker-engine/docker.init new file +112 -0

112 lines not on this page · raw message

Signature · 1 line
2.7.3
#8 lore raw

PATCH v6 4/5 package/docker-engine: proper sysv init file

All,

Quoted 4 lines

No idea why it added my signed-off again automatically, I just wanted to leave the ack, please excuse my random signed-off-by duplicates all over this series.

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

#9 lore raw

PATCH v6 4/5 package/docker-engine: proper sysv init file

Hello,

Quoted 10 lines · Christian Stewart

All,

Quoted 4 lines

No idea why it added my signed-off again automatically, I just wanted to leave the ack, please excuse my random signed-off-by duplicates all over this series.

The fact that it added your SoB is actually good. When you carry the patch from someone else, you need to SoB on his patch, because the chain of SoB indicates the chain of persons through which the patch has gone. That's why Peter and I also add our SoB when we apply and merge patches in Buildroot.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#10 lore raw

PATCH v6 4/5 package/docker-engine: proper sysv init file

In reply to Christian Stewart

Le 04/07/2016 ? 21:26, Christian Stewart a ?crit :

Quoted 8 lines

From: Andrew Webster <[email protected]>

The packaged redhat init file is not suitable for buildroot. This adds a customized version for buildroot.

I think patch 4/5 and 5/5 must be squashed with the patch adding docker-engine package since the redhad init file doesn't work with Buildroot.

Quoted 30 lines
---
 package/docker-engine/docker-engine.mk |   6 +-
 package/docker-engine/docker.init      | 112 +++++++++++++++++++++++++++++++++
 2 files changed, 115 insertions(+), 3 deletions(-)
 create mode 100644 package/docker-engine/docker.init
package/docker-engine/docker-engine.mk +3 -3
index 501afbc..4cb896c 100644
@@ -103,10 +103,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
package/docker-engine/docker.init new file +0 -0
new file mode 100644
index 0000000..a751551

package/docker-engine/docker.init line 2

Quoted 2 lines
package/docker-engine/docker.init new file +2 -0
@@ -0,0 +1,112 @@
+#!/bin/sh
+set -e

Other init script doesn't set exit on error.

Quoted 6 lines
package/docker-engine/docker.init new file +6 -0
+
+### BEGIN INIT INFO
+# Provides:           docker
+# Required-Start:     $syslog $remote_fs
+# Required-Stop:      $syslog $remote_fs
+# Should-Start:       cgroupfs-mount cgroup-lite

package/docker-engine/docker.init line 18

Quoted 10 lines
package/docker-engine/docker.init new file +10 -0
+# 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

run level are not used if Busybox init is used, so we can remove this comment.

package/docker-engine/docker.init line 20

Quoted 2 lines
package/docker-engine/docker.init new file +2 -0
+
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin

Why are you adding /usr/local/bin to the PATH here ?

By default the PATH is: /usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin

http://www.tldp.org/HOWTO/Path-4.html

package/docker-engine/docker.init line 31

Quoted 11 lines
package/docker-engine/docker.init new file +11 -0
+
+BASE=docker
+
+# modify these in /etc/default/$BASE (/etc/default/docker)
+DOCKERD=/usr/bin/dockerd
+# 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_OPTS can be removed

Quoted 4 lines
package/docker-engine/docker.init new file +4 -0
+DOCKER_DESC="Docker"
+
+if [ -f /etc/default/$BASE ]; then
+       . /etc/default/$BASE

package/docker-engine/docker.init line 45

Quoted 10 lines
package/docker-engine/docker.init new file +10 -0
+fi
+
+# Check docker is present
+if [ ! -x $DOCKERD ]; then
+       echo "$DOCKERD not present or not executable"
+       exit 1
+fi
+
+cgroupfs_mount() {
+       # see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
                                                                   ^

I think the comment should use a hast instead of master branch, the content of cgroupfs-mount may change over the time.

Quoted 21 lines
package/docker-engine/docker.init new file +21 -0
+       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
+       )
+}
+

package/docker-engine/docker.init line 76

Quoted 10 lines
package/docker-engine/docker.init new file +10 -0
+case "$1" in
+       start)
+               cgroupfs_mount
+
+               ulimit -n 1048576
+               if [ "$BASH" ]; then
+                       ulimit -u 1048576
+               else
+                       ulimit -p 1048576
+               fi

The init shell is not bash, so the test on $BASH is never true.

Quoted 13 lines
package/docker-engine/docker.init new file +13 -0
+
+               echo "Starting $DOCKER_DESC: $BASE"
+               start-stop-daemon --start --background \
+                       --exec "$DOCKERD" \
+                       --pidfile "$DOCKER_SSD_PIDFILE" \
+                       --make-pidfile \
+                       -- \
+                               -p "$DOCKER_PIDFILE" \
+                               $DOCKER_OPTS \
+                                       >> "$DOCKER_LOGFILE" 2>&1
+               echo $?
+               ;;
+

package/docker-engine/docker.init line 99

Quoted 10 lines
package/docker-engine/docker.init new file +10 -0
+       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 \

Please, squash the next patch here.
Indeed ps -p is not supported by busybox, if you really need it then you can select procps-ng package.

Quoted 14 lines
package/docker-engine/docker.init new file +13 -0
+                       && $0 stop
+               $0 start
+               ;;
+
+       force-reload)
+               $0 restart
+               ;;
+
+       *)
+               echo "Usage: service docker {start|stop|restart}"
+               exit 1
+               ;;
+esac
#11 lore raw

PATCH v6 5/5 package/docker-engine: restart - switch from ps -p to searching proc

In reply to Christian Stewart

From: Andrew Webster <[email protected]>

The busybox ps may not support -p, so search procfs instead to determine if docker is running.

---
 package/docker-engine/docker.init | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/docker-engine/docker.init +3 -2
index a751551..36c7786 100644
@@ -96,8 +96,9 @@ case "$1" in
        restart)
                docker_pid=`cat "$DOCKER_SSD_PIDFILE" 2>/dev/null`
                [ -n "$docker_pid" ] \
-                       && ps -p $docker_pid > /dev/null 2>&1 \
-                       && $0 stop
+                       && [ -d /proc/$docker_pid ] \
+                       && $0 stop \
+                       && sleep 1
                $0 start
                ;;
 
Signature · 1 line
2.7.3
#12 lore raw

PATCH v6 1/5 runc: new package

In reply to Christian Stewart

Hi Christian,

Thanks for this new series.

Le 04/07/2016 ? 21:26, Christian Stewart a ?crit :

Quoted 83 lines

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/

---

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
Changes since v5:
- bump to v1.0.0-rc1

---

---
 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
package/Config.in +1 -0
index 2c4c196..078436e 100644
@@ -1665,6 +1665,7 @@ menu "System tools"
 	source "package/pwgen/Config.in"
 	source "package/quota/Config.in"
 	source "package/rsyslog/Config.in"
+	source "package/runc/Config.in"
 	source "package/scrub/Config.in"
 	source "package/scrypt/Config.in"
 	source "package/smack/Config.in"
package/runc/Config.in new file +13 -0
new file mode 100644
index 0000000..1802e59
@@ -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
package/runc/runc.hash new file +2 -0
new file mode 100644
index 0000000..e6ec483
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 77f9d4df1657fecc939be0261fcccccd34d5b22c02b8a49abad23fac33b4059a  runc-v1.0.0-rc1.tar.gz
package/runc/runc.mk new file +0 -0
new file mode 100644
index 0000000..3f352bd

package/runc/runc.mk line 7

Quoted 7 lines
package/runc/runc.mk new file +7 -0
@@ -0,0 +1,46 @@
+################################################################################
+#
+# runc
+#
+################################################################################
+
+RUNC_VERSION = v1.0.0-rc1

Usually we prefer a stable release but ok for this new package.

Best regards,
Romain

Quoted 40 lines
package/runc/runc.mk new file +39 -0
+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))
#13 lore raw

PATCH v6 1/5 runc: new package

Romain,
On Mon, Jul 4, 2016 1:05 PM, Romain Naour romain.naour at gmail.com wrote: Usually we prefer a stable release but ok for this new package. Unfortunately they haven't spun a release in ages and Docker is using a commit
pin as well. It's a bit of a weird setup they have going.
I have it pinned to a newer release because some aarch64 fixes are in there.
Best, Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160704/8c88c8c0/attachment.html>

#14 lore raw

PATCH v6 1/5 runc: new package

Le 04/07/2016 ? 22:09, Christian Stewart a ?crit :

Quoted 5 lines

Romain,

On Mon, Jul 4, 2016 1:05 PM, Romain Naour romain.naour at gmail.com <mailto:[email protected]> wrote:

Quoted 7 lines

Usually we prefer a stable release but ok for this new package.

Unfortunately they haven't spun a release in ages and Docker is using a commit pin as well. It's a bit of a weird setup they have going.

I have it pinned to a newer release because some aarch64 fixes are in there.

I asked to Thomas about using -rc version and he say that it's fine for a new package and to avoid carrying to much patches in Buildroot.

Best regards,
Romain

Quoted 4 lines

Best,
Christian