Skip to contentSkip to conversation

Add docker engine support

PATCH Superseded Christian Stewart 2 participants 8 messages May 27, 2016

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add docker engine support

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

Aufs is disabled in this version of the series until the pending aufs series is merged. This version of the series can be merged without aufs support, and aufs can simply be enabled with another patch later after the aufs series is merged.

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.

Changes for v2:

- Fixed many minor mistakes in the original runC files
- Added hashes
- Added docker-containerd and docker-engine

Changes for v3:

- Use correct github download URLs
- Add note about arm64 fixes in docker-containerd

Changes for v4:

- Numerous fixes from Thomas's peer review (thanks!)
- Removed docker graphdriver selection from docker-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 | 184 +++++++++++++++++++++++
 package/docker-containerd/Config.in              |  12 ++
 package/docker-containerd/docker-containerd.hash |   2 +
 package/docker-containerd/docker-containerd.mk   |  45 ++++++
 package/docker-engine/Config.in                  |  36 +++++
 package/docker-engine/docker-engine.hash         |   2 +
 package/docker-engine/docker-engine.mk           |  82 ++++++++++
 package/runc/Config.in                           |  12 ++
 package/runc/runc.hash                           |   2 +
 package/runc/runc.mk                             |  47 ++++++
 11 files changed, 427 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
Signature · 1 line
2.7.3
#1 lore raw

PATCH v4 1/3 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

---

---
 package/Config.in      |  1 +
 package/runc/Config.in | 12 ++++++++++++
 package/runc/runc.hash |  2 ++
 package/runc/runc.mk   | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 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 9d668bf..6c513ba 100644
@@ -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"
package/runc/Config.in new file +12 -0
new file mode 100644
index 0000000..7d0c951
@@ -0,0 +1,12 @@
+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_TOOLCHAIN_HAS_THREADS
package/runc/runc.hash new file +2 -0
new file mode 100644
index 0000000..c109c33
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 f9955daed1e73e842b2f28a258fba51f4e72a6b4b64cc3fc06415481d55ce000  runc-v0.1.1.tar.gz
package/runc/runc.mk new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.7.3
#2 lore raw

PATCH v4 1/3 runc: new package

Hello,

Quoted 8 lines · Christian Stewart
package/runc/Config.in new file +2 -0
new file mode 100644
index 0000000..7d0c951
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_RUNC
+	bool "runc"

package/runc/Config.in line 12

Quoted 10 lines
package/runc/Config.in new file +10 -0
+	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_TOOLCHAIN_HAS_THREADS

The comment also needs the dependency on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS in order to not show the comment on architectures on which Go support is anyway not available.

package/runc/Config.in

Quoted 8 lines
package/runc/Config.in new file +8 -0
+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_COMMIT) \

As asked in my review of the previous version, what about using RUNC_VERSION here?

Other than that, looks good to me.

Thomas

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

PATCH v4 2/3 docker-containerd: new package

In reply to Christian Stewart

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

---

---
 package/Config.in                                |   1 +
 package/docker-containerd/0001-arm64-fixes.patch | 184 +++++++++++++++++++++++
 package/docker-containerd/Config.in              |  12 ++
 package/docker-containerd/docker-containerd.hash |   2 +
 package/docker-containerd/docker-containerd.mk   |  45 ++++++
 5 files changed, 244 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
package/Config.in +1 -0
index 6c513ba..c8365f8 100644
@@ -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"
package/docker-containerd/0001-arm64-fixes.patch new file +184 -0

184 lines not on this page · raw message

package/docker-containerd/Config.in new file +12 -0
new file mode 100644
index 0000000..5919347
@@ -0,0 +1,12 @@
+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_TOOLCHAIN_HAS_THREADS
package/docker-containerd/docker-containerd.hash new file +2 -0
new file mode 100644
index 0000000..0221b69
@@ -0,0 +1,2 @@
+# Computed locally
+sha256 f9dfeaba17064f279a7dfe89f0ef6763ee45b0a57c03aa423da2af340fba198d  docker-containerd-v0.2.1.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
#4 lore raw

PATCH v4 2/3 docker-containerd: new package

Hello,

Quoted 20 lines · Christian Stewart
package/docker-containerd/0001-arm64-fixes.patch new file +14 -0
new file mode 100644
index 0000000..488822a
@@ -0,0 +1,184 @@
+From f6f54370d154b0ce5f35319d878048d7db8db89c Mon Sep 17 00:00:00 2001
+From: Lei Jitang <[email protected]>
+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 <[email protected]>
+
+archutils: epoll_aarch64: fix C formatting

package/docker-containerd/0001-arm64-fixes.patch line 24

Quoted 10 lines
package/docker-containerd/0001-arm64-fixes.patch new file +10 -0
+Signed-off-by: Aleksa Sarai <[email protected]>
+
+archutils: fix build on aarch64
+Signed-off-by: Aleksa Sarai <[email protected]>
+
+Use flag for aarch64 EpollCreate1
+Signed-off-by: Qiang Huang <[email protected]>
+
+Correct build flag for arm64
+Signed-off-by: Qiang Huang <[email protected]>

Needs your Signed-off-by here.

Quoted 8 lines
package/docker-containerd/Config.in new file +2 -0
new file mode 100644
index 0000000..5919347
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_DOCKER_CONTAINERD
+	bool "docker-containerd"

package/docker-containerd/Config.in line 12

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

BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS dependency.

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

package/docker-containerd/Config.in

Quoted 10 lines
package/docker-containerd/Config.in new file +10 -0
+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 -s $(TARGET_DIR)/usr/bin/runc $(TARGET_DIR)/usr/bin/docker-runc

Did you do a runtime test? Because this clearly cannot work: it means that on the target you will have a link like:

	/usr/bin/docker-runc -> /home/christian/buildroot/output/target/usr/bin/runc

which obviously will not work. You instead want:

	ln -s runc $(TARGET_DIR)/usr/bin/docker-runc

Thomas

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

PATCH v4 2/3 docker-containerd: new package

Thomas,

Quoted 3 lines · Thomas Petazzoni

Needs your Signed-off-by here.

Okay, will add.

Quoted 6 lines

+ depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS

BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS dependency.

Not sure what you're saying here

Did you do a runtime test? Because this clearly cannot work: it means

Quoted 9 lines

that on the target you will have a link like:

        /usr/bin/docker-runc ->

/home/christian/buildroot/output/target/usr/bin/runc

which obviously will not work. You instead want:

        ln -s runc $(TARGET_DIR)/usr/bin/docker-runc

I asked about this in another email, it makes sense that that wouldn't work, I'll fix it for the next revision.

In terms of all the versioning stuff. I'll try using the _VERSION variables for this. As the variable specifically references a GitCommit, I included the commits as it wants. But it's probably not too bad of a compromise to use the version ID as the commit hash.

For the host variable, a patch series recently applied changed what that variable contained, and in particular, the changes to CGO caused the build to completely fail unless I included the variables from there, so I now include it and simply add a few things on top of it to build the full build env for the package.

Will revise on all of the series and respin late tomorrow, in case anyone else has suggestions :)

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

#6 lore raw

PATCH v4 2/3 docker-containerd: new package

Hello,

Quoted 7 lines · Christian Stewart
Quoted 5 lines

+ depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS

BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS dependency.

Not sure what you're saying here

I explained it in the review of another patch from you.

When you have:

comment "<foo> needs a toolchain w/ threads"
depends on !BR2_TOOLCHAIN_HAS_THREADS

you *must* also add:

depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS

so that the comment doesn't show up on architectures for which there is no Go support.

Otherwise, imagine a user creating a configuration for say the Blackfin architecture (which doesn't have Go support), and initially with thread disabled. They see the comment "<foo> needs a toolchain w/ threads". So the user goes in the Toolchain menu, and enables thread. And then, the comment has disappeared, but the option to enable the package has not appeared.

Hence, we want to show the comment only when
BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS=y.

Quoted 4 lines

In terms of all the versioning stuff. I'll try using the _VERSION variables for this. As the variable specifically references a GitCommit, I included the commits as it wants. But it's probably not too bad of a compromise to use the version ID as the commit hash.

If it works, it's much better.

Quoted 8 lines

For the host variable, a patch series recently applied changed what that variable contained, and in particular, the changes to CGO caused the build to completely fail unless I included the variables from there, so I now include it and simply add a few things on top of it to build the full build env for the package.

Will revise on all of the series and respin late tomorrow, in case anyone else has suggestions :)

ACK, thanks!

Thomas

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

PATCH v4 3/3 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.

---

---
 package/Config.in                        |  1 +
 package/docker-engine/Config.in          | 36 ++++++++++++++
 package/docker-engine/docker-engine.hash |  2 +
 package/docker-engine/docker-engine.mk   | 82 ++++++++++++++++++++++++++++++++
 4 files changed, 121 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 c8365f8..b829075 100644
@@ -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"
package/docker-engine/Config.in new file +36 -0
new file mode 100644
index 0000000..20507f0
@@ -0,0 +1,36 @@
+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
+
+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"
+
+endif
+
+comment "docker-engine needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/docker-engine/docker-engine.hash new file +2 -0
new file mode 100644
index 0000000..7b93669
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 04de3750738b6f888f03520fb67db22e95e8a8e016ae901428e6c5791c9841cc  docker-engine-v1.11.1.tar.gz
package/docker-engine/docker-engine.mk new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
2.7.3