Skip to contentSkip to conversation

Add docker engine support

PATCH Superseded Christian Stewart 3 participants 12 messages May 25, 2016 – May 27, 2016

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 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

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

 package/Config.in                                |   3 +
 package/docker-containerd/Config.in              |   8 ++
 package/docker-containerd/docker-containerd.hash |   2 +
 package/docker-containerd/docker-containerd.mk   |  48 ++++++++++
 package/docker-engine/Config.in                  |  70 +++++++++++++++
 package/docker-engine/docker-engine.hash         |   2 +
 package/docker-engine/docker-engine.mk           | 110 +++++++++++++++++++++++
 package/runc/Config.in                           |   8 ++
 package/runc/runc.hash                           |   2 +
 package/runc/runc.mk                             |  49 ++++++++++
 10 files changed, 302 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
 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 v3 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

---

---
 package/Config.in      |  1 +
 package/runc/Config.in |  8 ++++++++
 package/runc/runc.hash |  2 ++
 package/runc/runc.mk   | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 60 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 +8 -0
new file mode 100644
index 0000000..99d55d0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_RUNC
+	bool "runc"
+	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+	help
+    runC is a CLI tool for spawning and running containers
+    according to the OCP specification.
+
+	  https://github.com/opencontainers/runc
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 +49 -0

49 lines not on this page · raw message

Signature · 1 line
2.7.3
#2 lore raw

PATCH v3 1/3 runc: new package

Hello,

package/runc/Config.in line 3

Quoted 9 lines · Christian Stewart
package/runc/Config.in new file +3 -0
new file mode 100644
index 0000000..99d55d0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_RUNC
+	bool "runc"
+	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS

It seems like it uses cgo, so you need a dependency on BR2_TOOLCHAIN_HAS_THREADS here + the corresponding Config.in comment.

package/runc/Config.in line 6

Quoted 3 lines
package/runc/Config.in new file +3 -0
+	help
+    runC is a CLI tool for spawning and running containers
+    according to the OCP specification.

Indentation for the help text is one tab + two spaces.

Quoted 8 lines
package/runc/Config.in new file +2 -0
+
+	  https://github.com/opencontainers/runc
package/runc/runc.mk new file +0 -0
new file mode 100644
index 0000000..5032fa4

package/runc/runc.mk line 8

Quoted 8 lines
package/runc/runc.mk new file +8 -0
@@ -0,0 +1,49 @@
+################################################################################
+#
+# runc
+#
+################################################################################
+
+RUNC_VERSION = v0.1.1
+RUNC_VERSION_COMMIT = baf6536d6259209c3edfa2b22237af82942d3dfa

Why is this thing needed? I see you use it below, but it seems weird.

package/runc/runc.mk line 20

Quoted 12 lines
package/runc/runc.mk new file +12 -0
+RUNC_SITE = $(call github,opencontainers,runc,$(RUNC_VERSION))
+
+RUNC_LICENSE = Apache-2.0
+RUNC_LICENSE_FILES = LICENSE
+
+RUNC_DEPENDENCIES = host-go
+
+RUNC_MAKE_ENV = \
+	GOBIN="$(@D)/bin" \
+	GOPATH="$(@D)/Godeps/_workspace" \
+	GOARCH=$(GO_GOARCH) \
+	CGO_ENABLED=1

I guess you should use HOST_GO_TARGET_ENV, as in
http://patchwork.ozlabs.org/patch/626824/.

Quoted 4 lines
package/runc/runc.mk new file +4 -0
+RUNC_GLDFLAGS = \
+	-X main.gitCommit=$(RUNC_VERSION_COMMIT) \
+	-extldflags '-static'
+

package/runc/runc.mk line 35

Quoted 10 lines
package/runc/runc.mk new file +10 -0
+RUNC_GOTAGS = cgo static_build
+
+ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
+RUNC_GOTAGS += seccomp
+RUNC_DEPENDENCIES += libseccomp
+endif
+
+define RUNC_CONFIGURE_CMDS
+	# Put sources at prescribed GOPATH location.
+	export $(RUNC_MAKE_ENV) && \

What is the export doing here?

package/runc/runc.mk line 37

Quoted 2 lines
package/runc/runc.mk new file +2 -0
+		mkdir -p $$GOPATH/src/github.com/opencontainers && \
+		ln -s $(@D) $$GOPATH/src/github.com/opencontainers/runc

There is no need for a && between those lines.

And why is this needed at all? What is this "prescribed GOPATH" thing ?

package/runc/runc.mk line 47

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

Other than that, looks good to me.

Thanks,

Thomas

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

PATCH v3 1/3 runc: new package

Hi,

Quoted 5 lines · Thomas Petazzoni

On Wed, 25 May 2016 16:31:20 -0700, Christian Stewart wrote:
+define RUNC_CONFIGURE_CMDS

Quoted 2 lines

+> > > > # Put sources at prescribed GOPATH location.
+> > > > export $(RUNC_MAKE_ENV) && \

Quoted 8 lines

What is the export doing here?

Quoted 2 lines

+> > > > > > mkdir -p $$GOPATH/src/github.com/opencontainers && \
+> > > > > > ln -s $(@D) $$GOPATH/src/github.com/opencontainers/runc

There is no need for a && between those lines.

And why is this needed at all? What is this "prescribed GOPATH" thing ?

Go expects the developer to have a 'workspace' with a prescribed directory layout. Many projects archive their sources with a truncated path, so when they are extracted to a directory (@D in buildroot's case) things need to be fix enough for the go compiler to work. This is a common situation, and these fixups are often seen in project build scripts.

See https://golang.org/doc/code.html#Workspaces

-Geoff

#4 lore raw

PATCH v3 1/3 runc: new package

Hello,

Quoted 9 lines · Geoff Levand

Go expects the developer to have a 'workspace' with a prescribed directory layout. Many projects archive their sources with a truncated path, so when they are extracted to a directory (@D in buildroot's case) things need to be fix enough for the go compiler to work. This is a common situation, and these fixups are often seen in project build scripts.

See https://golang.org/doc/code.html#Workspaces

I have no problem with Go requiring a "workspace" to have a certain organization. But why does these workspaces all need to be in $$GOPATH ? Why can't $(@D) for each package contain a workspace ?

Thomas

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

PATCH v3 1/3 runc: new package

In reply to Thomas Petazzoni

Thomas,

Quoted 1 line · Thomas Petazzoni

It seems like it uses cgo, so you need a dependency on

BR2_TOOLCHAIN_HAS_THREADS here + the corresponding Config.in comment. Noted, will fix for the next revision.

Quoted 1 line

Why is this thing needed? I see you use it below, but it seems weird.

In the build scripts they use git commands to grab the commit ID. I replaced this in this series with a hardcoded git commit reference since we're not using git to fetch the source tree anymore, instead we're using tarballs. But including the commit hash the code originated from allows checking the revision properly down the line.
This value is included in version outputs on the actual device - i.e. ?runc -v?

Quoted 1 line

Indentation for the help text is one tab + two spaces.

Will fix.

Quoted 1 line

I guess you should use HOST_GO_TARGET_ENV, as in http://patchwork.ozlabs.org/patch/626824/ .

I looked at that and it didn't seem quite right, and that's liable to change down the line, so I copied it here. Keeping the envs package specific seems to me the most reliable solution.

Quoted 1 line

What is the export doing here?

Setting up GOPATH and GOBIN, this is also why I use the && on the next lines, otherwise we would have to write the env statement for all of those lines.
The purpose of those commands is to place the ?runc? sources at the proper location within the gopath tree. Go requires a tree to locate code. So inside runc, assuming there's ?pkg/foo?, the path would be ?github.com/opencontainers/runc/pkg/foo?. The GOPATH filesystem tree must match this.
To fix this problem, we build a ?vendor? tree with dependencies, and then
simlink ?runc? into the proper location within that tree. This allows Go to resolve everything properly.
The same applies to the other patches in this series.
I will fix the formatting issues and other things mentioned above and respin in
a couple of days.
Best, Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160526/71929d97/attachment.html>

#6 lore raw

PATCH v3 1/3 runc: new package

Hello,

Quoted 7 lines · Christian Stewart
Quoted 1 line

Why is this thing needed? I see you use it below, but it seems weird.

In the build scripts they use git commands to grab the commit ID. I replaced this in this series with a hardcoded git commit reference since we're not using git to fetch the source tree anymore, instead we're using tarballs. But including the commit hash the code originated from allows checking the revision properly down the line.
This value is included in version outputs on the actual device - i.e. ?runc -v?

Then why not use the <pkg>_VERSION variable directly, like:

    -X main.gitCommit=$(RUNC_VERSION)
Quoted 4 lines
Quoted 1 line

I guess you should use HOST_GO_TARGET_ENV, as in http://patchwork.ozlabs.org/patch/626824/ .

I looked at that and it didn't seem quite right, and that's liable to change down the line, so I copied it here. Keeping the envs package specific seems to me the most reliable solution.

I'm sorry, I don't understand what you mean here. The go package conveniently provides a variable for packages to use, to avoid mistakes and duplications in packages. When such a variable exists, it should definitely be used, and packages should not duplicate similar information, as it's a big maintenance burden down the line.

But when I look at your v3, I see that you are now using HOST_GO_TARGET_ENV. So I really don't understand what you said here.

Quoted 14 lines
Quoted 1 line

What is the export doing here?

Setting up GOPATH and GOBIN, this is also why I use the && on the next lines, otherwise we would have to write the env statement for all of those lines. The purpose of those commands is to place the ?runc? sources at the proper location within the gopath tree. Go requires a tree to locate code. So inside runc, assuming there's ?pkg/foo?, the path would be ?github.com/opencontainers/runc/pkg/foo?. The GOPATH filesystem tree must match this.
To fix this problem, we build a ?vendor? tree with dependencies, and then simlink ?runc? into the proper location within that tree. This allows Go to resolve everything properly.
The same applies to the other patches in this series.
I will fix the formatting issues and other things mentioned above and respin in a couple of days.

OK, thanks for the explanation. I see you fixed the export as well, which is good.

Thomas

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

PATCH v3 2/3 docker-containerd: new package

In reply to Christian Stewart

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

Note: fixes for arm64 (armv8) will be included in the next Docker release. A temporary cherry-pick of relevant arm64 fixes is available:

Commit f51d17f7 from https://github.com/paralin/buildroot.git

https://containerd.tools/

---

Changes since v1:
- Use proper github URL syntax
Changes since v2:
- Fix hash on download file

---
 package/Config.in                                |  1 +
 package/docker-containerd/Config.in              |  8 ++++
 package/docker-containerd/docker-containerd.hash |  2 +
 package/docker-containerd/docker-containerd.mk   | 48 ++++++++++++++++++++++++
 4 files changed, 59 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 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/Config.in new file +8 -0
new file mode 100644
index 0000000..6b3760d
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_DOCKER_CONTAINERD
+	bool "docker-containerd"
+	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+	select BR2_PACKAGE_RUNC
+	help
+    containerd is a daemon to control runC.
+
+	  https://github.com/docker/containerd
package/docker-containerd/docker-containerd.hash new file +2 -0
new file mode 100644
index 0000000..be0d856
@@ -0,0 +1,2 @@
+# Computed locally
+sha256 f9dfeaba17064f279a7dfe89f0ef6763ee45b0a57c03aa423da2af340fba198d  v0.2.1.tar.gz
package/docker-containerd/docker-containerd.mk new file +48 -0

48 lines not on this page · raw message

Signature · 1 line
2.7.3
#8 lore raw

PATCH v3 2/3 docker-containerd: new package

Hello,

Quoted 7 lines · Christian Stewart

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

Note: fixes for arm64 (armv8) will be included in the next Docker release. A temporary cherry-pick of relevant arm64 fixes is available:

Commit f51d17f7 from https://github.com/paralin/buildroot.git

Well, then either include the required patch, or disable the build on arm64 for now.

package/docker-containerd/Config.in line 3

Quoted 9 lines
package/docker-containerd/Config.in new file +3 -0
new file mode 100644
index 0000000..6b3760d
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_DOCKER_CONTAINERD
+	bool "docker-containerd"
+	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS

Thread dependency or not?

package/docker-containerd/Config.in line 6

Quoted 3 lines
package/docker-containerd/Config.in new file +3 -0
+	select BR2_PACKAGE_RUNC
+	help
+    containerd is a daemon to control runC.

Identation: one tab + two spaces.

Quoted 6 lines
package/docker-containerd/docker-containerd.mk new file +0 -0
new file mode 100644
index 0000000..9225143

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

Quoted 8 lines
package/docker-containerd/docker-containerd.mk new file +8 -0
@@ -0,0 +1,48 @@
+################################################################################
+#
+# docker-containerd
+#
+################################################################################
+
+DOCKER_CONTAINERD_VERSION = v0.2.1
+DOCKER_CONTAINERD_VERSION_COMMIT = ca47f7e76a93e9b3768ed084d62318e85bd9f4b2

Same question: why?

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

Quoted 6 lines
package/docker-containerd/docker-containerd.mk new file +6 -0
+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 runc

So runc is really a build-time dependency?

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

Quoted 6 lines
package/docker-containerd/docker-containerd.mk new file +6 -0
+
+DOCKER_CONTAINERD_MAKE_ENV = \
+	GOBIN="$(@D)/bin" \
+	GOPATH="$(@D)/vendor" \
+	GOARCH=$(GO_GOARCH) \
+	CGO_ENABLED=1

Usage of HOST_GO_TARGET_ENV ?

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

Quoted 3 lines
package/docker-containerd/docker-containerd.mk new file +3 -0
+
+DOCKER_CONTAINERD_GLDFLAGS = \
+	-X github.com/docker/containerd.GitCommit=$(DOCKER_CONTAINERD_VERSION_COMMIT) \

Why does it need this information?

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

Quoted 5 lines
package/docker-containerd/docker-containerd.mk new file +5 -0
+	-extldflags '-static'
+
+define DOCKER_CONTAINERD_CONFIGURE_CMDS
+	# Put sources at prescribed GOPATH location.
+	export $(DOCKER_CONTAINERD_MAKE_ENV) && \

Why this export ?

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

Quoted 4 lines
package/docker-containerd/docker-containerd.mk new file +4 -0
+		mkdir -p $$GOPATH/src/github.com/docker && \
+		ln -s $(@D) $$GOPATH/src/github.com/docker/containerd && \
+		mkdir -p $$GOPATH/src/github.com/opencontainers && \
+		ln -s $(RUNC_SRCDIR) $$GOPATH/src/github.com/opencontainers/runc

Same remarks as with the other package:

*) Why is this needed

*) No need for the &&, these can be independent commands, one after
the other.

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

Quoted 4 lines
package/docker-containerd/docker-containerd.mk new file +4 -0
+endef
+
+define DOCKER_CONTAINERD_BUILD_CMDS
+	cd $(@D) && export $(DOCKER_CONTAINERD_MAKE_ENV) && \

Why is export needed? Just do:

	$(DOCKER_CONTAINERD_MAKE_ENV) $(HOST_DIR)/usr/bin/go ...

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

Quoted 3 lines
package/docker-containerd/docker-containerd.mk new file +3 -0
+		$(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/ctr -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./ctr && \
+		$(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/containerd -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./containerd && \
+		$(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/containerd-shim -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./containerd-shim

No need for the &&, make these independent commands.

Is the "cd $(@D)" really needed ? Isn't it possible to do:

$(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/containerd-shim -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" $(@D)/containerd-shim

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

Quoted 4 lines
package/docker-containerd/docker-containerd.mk new file +4 -0
+endef
+
+define DOCKER_CONTAINERD_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(TARGET_DIR)/usr/bin/runc $(TARGET_DIR)/usr/bin/docker-runc

Why are you doing this? If it really needs to be called docker-runc, why not just a symbolic link ?

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

Quoted 5 lines
package/docker-containerd/docker-containerd.mk new file +5 -0
+	$(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))

Thanks,

Thomas

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

PATCH v3 2/3 docker-containerd: new package

Thomas,
On Thu, May 26, 2016 12:29 PM, Thomas Petazzoni thomas.petazzoni at free-electrons.com wrote: > Thread dependency or not? Yes, added comment + dep as with runc.

Quoted 1 line

So runc is really a build-time dependency?

Only if I copy runc to docker-runc, but given it's a symbolic link, I removed this in the next version.
If I use an absolute path to make the symbolic link, will this cause problems on the target device?

Quoted 1 line

No need for the &&, make these independent commands.

If I do this, I will need to duplicate the env statement as well as the cd. And no, it's not possible to specify an absolute path to build. This produces this kind of error:

can't load package: package /home/paralin/Documents/skiff/workspaces/default/output/build/docker-containerd-v0.2.1/ctr:
import ?/home/paralin/Documents/skiff/workspaces/default/output/build/docker-containerd-v0.2.1/ctr?:
cannot import absolute path
Other than that, will apply these changes and respin.
Best, Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160526/4d116b1b/attachment.html>

#10 lore raw

PATCH v3 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 v2:
- fix hashes

---
 package/Config.in                        |   1 +
 package/docker-engine/Config.in          |  70 ++++++++++++++++++++
 package/docker-engine/docker-engine.hash |   2 +
 package/docker-engine/docker-engine.mk   | 110 +++++++++++++++++++++++++++++++
 4 files changed, 183 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..b54c5b9 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-engine/Config.in"
 	source "package/docker-containerd/Config.in"
 	source "package/cgroupfs-mount/Config.in"
 	source "package/dsp-tools/Config.in"
package/docker-engine/Config.in new file +70 -0

70 lines not on this page · raw message

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 +110 -0

110 lines not on this page · raw message

Signature · 1 line
2.7.3
#11 lore raw

PATCH v3 3/3 docker-engine: new package

Hello,

Great, docker in Buildroot! :-)

package/Config.in if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS · line 1635

Quoted 2 lines · Christian Stewart
package/Config.in +1 -0
+	source "package/docker-engine/Config.in"
 	source "package/docker-containerd/Config.in"

Alphabetic ordering please.

package/docker-engine/Config.in line 3

Quoted 11 lines
package/Config.in +0 -0
 	source "package/cgroupfs-mount/Config.in"
 	source "package/dsp-tools/Config.in"
package/docker-engine/Config.in new file +3 -0
new file mode 100644
index 0000000..e25b16b
@@ -0,0 +1,70 @@
+config BR2_PACKAGE_DOCKER_ENGINE
+	bool "docker-engine"
+	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS

Thread dependency?

package/docker-engine/Config.in line 11

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

You need to replicate the dependency of util-linux here, so:

depends on BR2_USE_WCHAR
depends on BR2_USE_MMU

package/docker-engine/Config.in line 16

Quoted 5 lines
package/docker-engine/Config.in new file +5 -0
+	help
+		Docker is a platform to build, ship,
+		and run applications as lightweight containers.
+
+		https://github.com/docker/docker

Indentation of the help text: one tab + two spaces.

package/docker-engine/Config.in line 24

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

Identation: one tab + two spaces, plus wrap at 72 characters.

Quoted 4 lines
package/docker-engine/Config.in new file +4 -0
+
+config BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL
+	bool "build experimental features"
+

package/docker-engine/Config.in line 38

Quoted 10 lines
package/docker-engine/Config.in new file +10 -0
+if BR2_PACKAGE_DOCKER_ENGINE_DAEMON
+
+config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_AUFS
+	bool "aufs filesystem driver"
+	depends on BR2_USE_WCHAR # aufs-util
+	depends on BR2_USE_MMU # aufs-util
+	depends on BR2_TOOLCHAIN_HAS_THREADS # aufs-util
+	select BR2_PACKAGE_AUFS_UTIL
+	help
+	  Build the aufs filesystem driver for Docker.

Didn't you say in your cover letter that the AUFS support was not integrated? The symbol BR2_PACKAGE_AUFS_UTIL does not exist in Buildroot.

package/docker-engine/Config.in line 47

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

Indentation.

package/docker-engine/Config.in line 57

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

Ditto.

package/docker-engine/Config.in line 60

Quoted 3 lines
package/docker-engine/Config.in new file +3 -0
+
+config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS
+	bool "vfs filesystem driver"

Is the driver called vfs or gvfs ?

package/docker-engine/Config.in line 66

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

Ditto.

Quoted 18 lines
package/docker-engine/Config.in new file +4 -0
+
+endif
+
+endif
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 +0 -0
new file mode 100644
index 0000000..0dc6b46

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

Quoted 8 lines
package/docker-engine/docker-engine.mk new file +8 -0
@@ -0,0 +1,110 @@
+################################################################################
+#
+# docker-engine
+#
+################################################################################
+
+DOCKER_ENGINE_VERSION = v1.11.1
+DOCKER_ENGINE_VERSION_COMMIT = 5604cbed50d51c4039b1abcb1cf87c4e01bce924

Same question :)

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

Quoted 13 lines
package/docker-engine/docker-engine.mk new file +13 -0
+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_MAKE_ENV = \
+	GOBIN="$(@D)/bin" \
+	GOPATH="$(@D)/vendor" \
+	GOARCH=$(GO_GOARCH) \
+	CGO_ENABLED=1 \
+	CGO_NO_EMULATION=1

HOST_GO_TARGET_ENV usage

Quoted 13 lines
package/docker-engine/docker-engine.mk new file +13 -0
+
+DOCKER_ENGINE_GLDFLAGS = \
+	-X main.GitCommit=$(DOCKER_ENGINE_VERSION_COMMIT) \
+	-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
+

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

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

So docker links with some btrfs library?

Quoted 22 lines
package/docker-engine/docker-engine.mk new file +22 -0
+else
+DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_btrfs
+endif
+
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_AUFS),y)
+DOCKER_ENGINE_DEPENDENCIES += aufs-util
+else
+DOCKER_ENGINE_BUILD_TAGS += exclude_graphdriver_aufs
+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
+

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

Quoted 10 lines
package/docker-engine/docker-engine.mk new file +10 -0
+define DOCKER_ENGINE_CONFIGURE_CMDS
+	# Put sources at prescribed GOPATH location.
+	export $(DOCKER_ENGINE_MAKE_ENV) && \
+		$(SED) '/^clean$$/d' $(@D)/hack/vendor.sh && \
+		cd $(@D) && bash ./hack/vendor.sh && \
+		mkdir -p $(@D)/vendor/src/github.com/docker && \
+		ln -s $(@D) $(@D)/vendor/src/github.com/docker/docker && \
+		ln -s $(DOCKER_CONTAINERD_SRCDIR) $(@D)/vendor/src/github.com/docker/containerd && \
+		mkdir -p $$GOPATH/src/github.com/opencontainers && \
+		ln -s $(RUNC_SRCDIR) $(@D)/vendor/src/github.com/opencontainers/runc

Same comments as with other packages.

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

Quoted 6 lines
package/docker-engine/docker-engine.mk new file +6 -0
+endef
+
+define DOCKER_ENGINE_BUILD_CMDS
+	cd $(@D) && export $(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

Ditto.

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

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

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

Is the sysvinit-redhat script actually working in Buildroot with a Busybox shell?

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

Quoted 1 line
package/docker-engine/docker-engine.mk new file +1 -0
+	mkdir -p $(TARGET_DIR)/etc/sysconfig

Not needed $(INSTALL) -D does it for you.

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

Quoted 9 lines
package/docker-engine/docker-engine.mk new file +9 -0
+	$(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))

Thanks a lot!

Thomas

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