Skip to contentSkip to conversation

package/docker-containerd: bump to latest

PATCH New Christian Stewart 3 participants 8 messages Jul 22, 2016 – Jul 27, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v9 1/2 package/docker-containerd: bump to latest

Bump the pinned docker-containerd version to the latest in advance of the introduction of docker-engine v1.12.0-rc4.

---
 package/docker-containerd/docker-containerd.hash | 2 +-
 package/docker-containerd/docker-containerd.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/docker-containerd/docker-containerd.hash +1 -1
index a4a427d..ec9c13e 100644
@@ -1,2 +1,2 @@
 # Computed locally
-sha256 bdfa54c94f3de901a7983dc0bc924dd2268e9a5f5fe920d27bfdafad60958522  docker-containerd-1b3a81545ca79456086dc2aa424357be98b962ee.tar.gz
+sha256 5c1bcd8e3b7bc6034e7523b6eca7de974562b7fdc72c440494234ae10a0e545b  docker-containerd-0ac3cd1be170d180b2baed755e8f0da547ceb267.tar.gz
package/docker-containerd/docker-containerd.mk +1 -1
index 7628fe1..b1acd44 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-DOCKER_CONTAINERD_VERSION = 1b3a81545ca79456086dc2aa424357be98b962ee
+DOCKER_CONTAINERD_VERSION = 0ac3cd1be170d180b2baed755e8f0da547ceb267
 DOCKER_CONTAINERD_SITE = $(call github,docker,containerd,$(DOCKER_CONTAINERD_VERSION))
 DOCKER_CONTAINERD_LICENSE = Apache-2.0
 DOCKER_CONTAINERD_LICENSE_FILES = LICENSE.code
Signature · 1 line
2.7.3
#1 lore raw

PATCH v9 2/2 docker-engine: new package

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.
Changes since v6:
- remove build-time dependency on docker-containerd and runc
- install dockerd only if daemon is enabled
- move all daemon dependencies into daemon selection
- only install sysv, users, etc if daemon is enabled
- add a proper sysv init file
- remove DOCKER_OPTS in init file
- remove test for $BASH as bash is never used for init
- use hash for documentation link in sysv init file
- remove unnecessary path change in sysv init file
- remove exit on error line in sysv init file
- remove init info comment from sysv init file
Changes since v7:
- remove "-static" cgo flag which fixes build of btrfs and other additional filesystem drivers.
- build + run test with alternate filesystem drivers.
Changes since v8:
- Bump to v1.12.0-rc4

---
 package/Config.in                        |   2 +
 package/docker-engine/Config.in          |  69 ++++++++++++++++++
 package/docker-engine/docker-engine.hash |   2 +
 package/docker-engine/docker-engine.mk   | 119 +++++++++++++++++++++++++++++++
 package/docker-engine/docker.init        |  89 +++++++++++++++++++++++
 5 files changed, 281 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
 create mode 100644 package/docker-engine/docker.init
package/Config.in +2 -0
index 6a84f9f..c871e63 100644
@@ -1667,6 +1667,8 @@ 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"
 	source "package/efivar/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..1de09f8
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 bc256d2a348efbf236eab991254c925fa1917dd1e29cb40586f1696f4e24852e  docker-engine-v1.12.0-rc4.tar.gz
package/docker-engine/docker-engine.mk new file +119 -0

119 lines not on this page · raw message

package/docker-engine/docker.init new file +89 -0

89 lines not on this page · raw message

Signature · 1 line
2.7.3
#2 lore raw

PATCH v9 2/2 docker-engine: new package

Hello,

package/Config.in menu "System tools" · line 1671

Quoted 10 lines · Christian Stewart
package/Config.in +2 -0
index 6a84f9f..c871e63 100644
@@ -1667,6 +1667,8 @@ 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"

cgroupfs-mount ?

Quoted 16 lines
package/Config.in +0 -0
 	source "package/dsp-tools/Config.in"
 	source "package/efibootmgr/Config.in"
 	source "package/efivar/Config.in"
package/docker-engine/Config.in new file +7 -0
new file mode 100644
index 0000000..82cd251
@@ -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
+	help
+	  Docker is a platform to build, ship,
+	  and run applications as lightweight containers.

package/docker-engine/Config.in line 17

Quoted 10 lines
package/docker-engine/Config.in new file +10 -0
+
+	  https://github.com/docker/docker
+
+if BR2_PACKAGE_DOCKER_ENGINE
+
+config BR2_PACKAGE_DOCKER_ENGINE_DAEMON
+	bool "docker daemon"
+	depends on BR2_USE_MMU # docker-containerd
+	depends on BR2_USE_WCHAR # docker-containerd
+	select BR2_PACKAGE_DOCKER_CONTAINERD # docker-containerd: runtime dependency

The comment should just be "# runtime dependency"

package/docker-engine/Config.in line 23

Quoted 6 lines
package/docker-engine/Config.in new file +6 -0
+	select BR2_PACKAGE_RUNC # docker-containerd: runtime dependency
+	select BR2_PACKAGE_UTIL_LINUX # docker-containerd: runtime dependency
+	select BR2_PACKAGE_UTIL_LINUX_BINARIES # docker-containerd: runtime dependency
+	select BR2_PACKAGE_UTIL_LINUX_PIVOT_ROOT # docker-containerd: runtime dependency
+	select BR2_PACKAGE_UTIL_LINUX_MOUNTPOINT # docker-containerd: runtime dependency
+	select BR2_PACKAGE_UTIL_LINUX_MOUNT # docker-containerd: runtime dependency

None of these lines are needed. All those packages are already selected by docker-containerd.

package/docker-engine/Config.in line 24

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

The comment should just be "# runtime dependency"

Quoted 21 lines
package/docker-engine/docker-engine.hash new file +2 -0
new file mode 100644
index 0000000..1de09f8
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 bc256d2a348efbf236eab991254c925fa1917dd1e29cb40586f1696f4e24852e  docker-engine-v1.12.0-rc4.tar.gz
package/docker-engine/docker-engine.mk new file +7 -0
new file mode 100644
index 0000000..9b0977d
@@ -0,0 +1,119 @@
+################################################################################
+#
+# docker-engine
+#
+################################################################################
+
+DOCKER_ENGINE_VERSION = v1.12.0-rc4

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

Quoted 10 lines
package/docker-engine/docker-engine.mk new file +10 -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_ENGINE_GOPATH = "$(@D)/vendor"
+DOCKER_ENGINE_MAKE_ENV = $(HOST_GO_TARGET_ENV) \
+	CGO_ENABLED=1 \

If you use CGO, then docker needs to also depend on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS, see docker-containerd.

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

Quoted 4 lines
package/docker-engine/docker-engine.mk new file +4 -0
+	CGO_NO_EMULATION=1 \
+	GOBIN="$(@D)/bin" \
+	GOPATH="$(DOCKER_ENGINE_GOPATH)" \
+	CPATH=$$CPATH:$(TARGET_DIR)/usr/include/ \

What is this CPATH ? Indeed there is usually nothing in TARGET_DIR/usr/include.

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

Quoted 12 lines
package/docker-engine/docker-engine.mk new file +12 -0
+	LIBRARY_PATH=$$LIBRARY_PATH:$(TARGET_DIR)/usr/lib/
+
+DOCKER_ENGINE_GLDFLAGS = \
+	-X main.GitCommit=$(DOCKER_ENGINE_VERSION) \
+	-X main.Version=$(DOCKER_ENGINE_VERSION)
+
+DOCKER_ENGINE_BUILD_TAGS = cgo exclude_graphdriver_zfs autogen
+
+ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
+DOCKER_ENGINE_BUILD_TAGS += seccomp
+DOCKER_ENGINE_DEPENDENCIES += libseccomp
+endif

Perhaps add (see below how I'm using this) :

DOCKER_ENGINE_BUILD_TARGETS = docker

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

Quoted 3 lines
package/docker-engine/docker-engine.mk new file +3 -0
+
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y)
+DOCKER_ENGINE_BUILD_TAGS += daemon

Add:

DOCKER_ENGINE_BUILD_TARGETS += dockerd

Quoted 38 lines
package/docker-engine/docker-engine.mk new file +38 -0
+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
+	ln -fs $(@D) $(DOCKER_ENGINE_GOPATH)/src/github.com/docker/docker
+	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_INSTALL_TARGET_CLIENT_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/bin/docker $(TARGET_DIR)/usr/bin/docker
+endef

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

Quoted 10 lines
package/docker-engine/docker-engine.mk new file +10 -0
+
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y)
+
+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
+
+define DOCKER_ENGINE_INSTALL_TARGET_DAEMON_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/bin/dockerd $(TARGET_DIR)/usr/bin/dockerd
+endef

Those four variables can be removed (see below why).

Quoted 17 lines
package/docker-engine/docker-engine.mk new file +17 -0
+
+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 package/docker-engine/docker.init \
+		$(TARGET_DIR)/etc/init.d/S61docker
+	$(INSTALL) -D -m 644 $(@D)/contrib/init/sysvinit-debian/docker.default \
+		$(TARGET_DIR)/etc/default/docker
+endef

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

Quoted 10 lines
package/docker-engine/docker-engine.mk new file +10 -0
+
+define DOCKER_ENGINE_USERS
+	- - docker -1 * - - - Docker Application Container Framework
+endef
+
+endif
+
+define DOCKER_ENGINE_BUILD_CMDS
+	$(DOCKER_ENGINE_BUILD_CLIENT_CMDS)
+	$(DOCKER_ENGINE_BUILD_DAEMON_CMDS)

Use:

	$(foreach target,$(DOCKER_ENGINE_BUILD_TARGETS), \
		cd $(@D); $(DOCKER_ENGINE_MAKE_ENV) \
			$(HOST_DIR)/usr/bin/go build -v \
				-o $(@D)/bin/$(target) \
				-tags "$(DOCKER_ENGINE_BUILD_TAGS)" \
				-ldflags "$(DOCKER_ENGINE_GLDFLAGS)" \
				./cmd/$(target)
	)

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

Quoted 5 lines
package/docker-engine/docker-engine.mk new file +5 -0
+endef
+
+define DOCKER_ENGINE_INSTALL_TARGET_CMDS
+	$(DOCKER_ENGINE_INSTALL_TARGET_CLIENT_CMDS)
+	$(DOCKER_ENGINE_INSTALL_TARGET_DAEMON_CMDS)

Use:

	$(foreach target,$(DOCKER_ENGINE_BUILD_TARGETS), \
		$(INSTALL) -D -m 0755 $(@D)/bin/$(target) $(TARGET_DIR)/usr/bin/$(target)
	)

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

Quoted 1 line
package/docker-engine/docker-engine.mk new file +1 -0
+++ b/package/docker-engine/docker.init

Should be named S61docker

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

Quoted 11 lines
package/docker-engine/docker-engine.mk new file +10 -0
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+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

Do we really need two pidfiles ? I don't think so. If docker creates its own pidfile, then start-stop-daemon can use it.

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

Quoted 12 lines
package/docker-engine/docker-engine.mk new file +12 -0
+DOCKER_LOGFILE=/var/log/$BASE.log
+DOCKER_DESC="Docker"
+
+if [ -f /etc/default/$BASE ]; then
+       . /etc/default/$BASE
+fi
+
+# Check docker is present
+if [ ! -x $DOCKERD ]; then
+       echo "$DOCKERD not present or not executable"
+       exit 1
+fi

This check is not needed. If this script is present, docker is installed. Or more exactly: if dockerd is needed for this script to work, then this script should only be installed when the docker daemon is enabled.

Quoted 12 lines
package/docker-engine/docker-engine.mk new file +12 -0
+
+cgroupfs_mount() {
+       # see also https://github.com/tianon/cgroupfs-mount/blob/951c38ee8d802330454bdede20d85ec1c0f8d312/cgroupfs-mount
+       if grep -v '^#' /etc/fstab | grep -q cgroup \
+               || [ ! -e /proc/cgroups ] \
+               || [ ! -d /sys/fs/cgroup ]; then
+               return
+       fi
+       if ! mountpoint -q /sys/fs/cgroup; then
+               mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
+       fi
+       (

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

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

Isn't this already done by the cgroupfs-mount package ?

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

Quoted 10 lines
package/docker-engine/docker-engine.mk new file +10 -0
+}
+
+case "$1" in
+       start)
+               cgroupfs_mount
+
+               ulimit -n 1048576
+               ulimit -p 1048576
+
+               echo "Starting $DOCKER_DESC: $BASE"

Use tabs for indentation.

Replace with:

printf "Starting docker: "

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

Quoted 4 lines
package/docker-engine/docker-engine.mk new file +4 -0
+               start-stop-daemon --start --background \
+                       --exec "$DOCKERD" \
+                       --pidfile "$DOCKER_SSD_PIDFILE" \
+                       --make-pidfile \

Use the short option, like we do in other init scripts, and get rid of the start-stop-daemon pid file if docker creates one.

start-stop-daemon -S -q -b -x $DOCKERD -- -p /var/run/docker.pid $DOCKER_OPTS

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

Quoted 4 lines
package/docker-engine/docker-engine.mk new file +4 -0
+                       -- \
+                               -p "$DOCKER_PIDFILE" \
+                               $DOCKER_OPTS \
+                                       >> "$DOCKER_LOGFILE" 2>&1

Is this redirect really doing something? When the --background/-b option of start-stop-daemon is used, I believe it closes the 0/1/2 file descriptors for the child process. Unless you enable option -C:

-C, --no-close
Do not close any file descriptor when forcing the daemon into the background (since version 1.16.5). Used for debugging pur? poses to see the process output, or to redirect file descriptors to log the process output. Only relevant when using --back? ground.

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

Quoted 1 line
package/docker-engine/docker-engine.mk new file +1 -0
+               echo $?

Replace with:

		[ $? = 0 ] && echo "OK" || echo "FAIL"

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

Quoted 4 lines
package/docker-engine/docker-engine.mk new file +4 -0
+               ;;
+
+       stop)
+               echo "Stopping $DOCKER_DESC: $BASE"

printf "Stopping docker: "

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

Quoted 1 line
package/docker-engine/docker-engine.mk new file +1 -0
+               start-stop-daemon --stop --pidfile "$DOCKER_SSD_PIDFILE" --retry 10

start-stop-daemon -K -q -p /var/run/docker.pid

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

Quoted 1 line
package/docker-engine/docker-engine.mk new file +1 -0
+               echo $?
		[ $? = 0 ] && echo "OK" || echo "FAIL"

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

Quoted 9 lines
package/docker-engine/docker-engine.mk new file +9 -0
+               ;;
+
+       restart)
+               docker_pid=`cat "$DOCKER_SSD_PIDFILE" 2>/dev/null`
+               [ -n "$docker_pid" ] \
+                       && [ -d /proc/$docker_pid ] \
+                       && $0 stop \
+                       && sleep 1
+               $0 start

Why? Just:

		$0 stop
		$0 start

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

Quoted 5 lines
package/docker-engine/docker-engine.mk new file +5 -0
+               ;;
+
+       force-reload)
+               $0 restart
+               ;;

Not needed.

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

Quoted 6 lines
package/docker-engine/docker-engine.mk new file +6 -0
+
+       *)
+               echo "Usage: service docker {start|stop|restart}"
+               exit 1
+               ;;
+esac

Thanks,

Thomas

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

PATCH v9 2/2 docker-engine: new package

Thomas,

Init scripts were written by Andrew so I will let him take those revisions.

Quoted 1 line · Thomas Petazzoni

The comment should just be "# runtime dependency"

Okay, acknowledged.

Quoted 2 lines

None of these lines are needed. All those packages are already selected by docker-containerd.

Removed, but I thought we had to propagate the "select" back up to the top level dependency. Maybe this is just for "depends."

Quoted 2 lines

If you use CGO, then docker needs to also depend on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS, see docker-containerd.

Added, thanks.

Quoted 2 lines

What is this CPATH ? Indeed there is usually nothing in TARGET_DIR/usr/include.

It's where the btrfs.h headers go, when btrfs is selected, fixes the cgo compilation errors when btrfs is enabled.

Quoted 19 lines

Use:

        $(foreach target,$(DOCKER_ENGINE_BUILD_TARGETS), \
                cd $(@D); $(DOCKER_ENGINE_MAKE_ENV) \
                        $(HOST_DIR)/usr/bin/go build -v \
                                -o $(@D)/bin/$(target) \
                                -tags "$(DOCKER_ENGINE_BUILD_TAGS)" \
                                -ldflags "$(DOCKER_ENGINE_GLDFLAGS)" \
                                ./cmd/$(target)
        )

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

Quoted 5 lines
package/docker-engine/docker-engine.mk new file +5 -0
+endef
+
+define DOCKER_ENGINE_INSTALL_TARGET_CMDS
+     $(DOCKER_ENGINE_INSTALL_TARGET_CLIENT_CMDS)
+     $(DOCKER_ENGINE_INSTALL_TARGET_DAEMON_CMDS)

Use:

Quoted 4 lines
        $(foreach target,$(DOCKER_ENGINE_BUILD_TARGETS), \
                $(INSTALL) -D -m 0755 $(@D)/bin/$(target) $(TARGET_DIR)/usr/bin/$(target)
        )

Changed, thanks.

Quoted 3 lines
Quoted 1 line

+++ b/package/docker-engine/docker.init

Should be named S61docker

Changed, thanks.

Quoted 15 lines

package/docker-engine/docker.init line 10

Quoted 12 lines
package/docker-engine/docker.init new file +10 -0
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+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

Do we really need two pidfiles ? I don't think so. If docker creates its own pidfile, then start-stop-daemon can use it.

This is more Andrew's speed, I'll let him respond.

Andrew, Thomas, the latest revision of this patch can be found here:

https://github.com/paralin/buildroot/commits/master

Best,
Christian

#4 lore raw

PATCH v9 2/2 docker-engine: new package

Hello,

Quoted 1 line · Christian Stewart

Init scripts were written by Andrew so I will let him take those revisions.

In this case, maybe you should just send a patch without any init script, and let Andrew send a follow-up patch for the init script.

Quoted 5 lines
Quoted 2 lines

None of these lines are needed. All those packages are already selected by docker-containerd.

Removed, but I thought we had to propagate the "select" back up to the top level dependency. Maybe this is just for "depends."

You have to propagate the "depends on" of the options you are "select"-ing.

Quoted 10 lines
Quoted 2 lines

If you use CGO, then docker needs to also depend on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS, see docker-containerd.

Added, thanks.

Quoted 2 lines

What is this CPATH ? Indeed there is usually nothing in TARGET_DIR/usr/include.

It's where the btrfs.h headers go, when btrfs is selected, fixes the cgo compilation errors when btrfs is enabled.

Seems weird, there are no headers on the target. Is it just used temporarily during the build?

Headers normally go in STAGING_DIR, not TARGET_DIR.

Thanks!

Thomas

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

PATCH v9 2/2 docker-engine: new package

Thomas,

Quoted 6 lines · Thomas Petazzoni
Quoted 1 line · Christian Stewart

Init scripts were written by Andrew so I will let him take those revisions.

In this case, maybe you should just send a patch without any init script, and let Andrew send a follow-up patch for the init script.

Will do, in fact, I've already split the init files out into a separate patch in my Github repo to give Andrew a head start on something to edit.

Quoted 2 lines

Seems weird, there are no headers on the target. Is it just used temporarily during the build?

I think so, yes. I checked in Staging Dir and there are no btrfs headers, but they are in the target dir.

Best,
Christian

#6 lore raw

PATCH v9 2/2 docker-engine: new package

In reply to Thomas Petazzoni

Thomas,

This init script is the same as the sysvinit-debian script packaged with docker, but with a few minor modifications. I won't be able to confidently answer some of your questions without doing some digging to find out why it was done that way initially, so this will be on hold for a bit.

Andrew

Quoted 160 lines

From: Thomas Petazzoni [mailto:thomas.petazzoni at free-electrons.com]
Sent: Sunday, July 24, 2016 9:29 AM

Quoted 1 line

+++ b/package/docker-engine/docker.init

Should be named S61docker

package/docker-engine/docker.init line 9

Quoted 10 lines
package/docker-engine/docker.init new file +9 -0
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+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

Do we really need two pidfiles ? I don't think so. If docker creates its own pidfile, then start-stop-daemon can use it.

package/docker-engine/docker.init line 22

Quoted 12 lines
package/docker-engine/docker.init new file +12 -0
+DOCKER_LOGFILE=/var/log/$BASE.log
+DOCKER_DESC="Docker"
+
+if [ -f /etc/default/$BASE ]; then
+       . /etc/default/$BASE
+fi
+
+# Check docker is present
+if [ ! -x $DOCKERD ]; then
+       echo "$DOCKERD not present or not executable"
+       exit 1
+fi

This check is not needed. If this script is present, docker is installed. Or more exactly: if dockerd is needed for this script to work, then this script should only be installed when the docker daemon is enabled.

Quoted 12 lines
package/docker-engine/docker.init new file +12 -0
+
+cgroupfs_mount() {
+       # see also https://github.com/tianon/cgroupfs-mount/blob/951c38ee8d802330454bdede20d85ec1c0f8d312/cgroupfs-mount
+       if grep -v '^#' /etc/fstab | grep -q cgroup \
+               || [ ! -e /proc/cgroups ] \
+               || [ ! -d /sys/fs/cgroup ]; then
+               return
+       fi
+       if ! mountpoint -q /sys/fs/cgroup; then
+               mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
+       fi
+       (

package/docker-engine/docker.init line 44

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

Isn't this already done by the cgroupfs-mount package ?

package/docker-engine/docker.init line 54

Quoted 10 lines
package/docker-engine/docker.init new file +10 -0
+}
+
+case "$1" in
+       start)
+               cgroupfs_mount
+
+               ulimit -n 1048576
+               ulimit -p 1048576
+
+               echo "Starting $DOCKER_DESC: $BASE"

Use tabs for indentation.

Replace with:

printf "Starting docker: "

package/docker-engine/docker.init line 58

Quoted 4 lines
package/docker-engine/docker.init new file +4 -0
+               start-stop-daemon --start --background \
+                       --exec "$DOCKERD" \
+                       --pidfile "$DOCKER_SSD_PIDFILE" \
+                       --make-pidfile \

Use the short option, like we do in other init scripts, and get rid of the start-stop-daemon pid file if docker creates one.

start-stop-daemon -S -q -b -x $DOCKERD -- -p /var/run/docker.pid $DOCKER_OPTS

package/docker-engine/docker.init line 62

Quoted 4 lines
package/docker-engine/docker.init new file +4 -0
+                       -- \
+                               -p "$DOCKER_PIDFILE" \
+                               $DOCKER_OPTS \
+                                       >> "$DOCKER_LOGFILE" 2>&1

Is this redirect really doing something? When the --background/-b option of start-stop-daemon is used, I believe it closes the 0/1/2 file descriptors for the child process. Unless you enable option -C:

-C, --no-close
Do not close any file descriptor when forcing the daemon into the background (since version 1.16.5). Used for debugging pur? poses to see the process output, or to redirect file descriptors to log the process output. Only relevant when using --back? ground.

Review line 62

Quoted 1 line
(quoted diff) +1 -0
+               echo $?

Replace with:

		[ $? = 0 ] && echo "OK" || echo "FAIL"

package/docker-engine/docker.init line 67

Quoted 4 lines
package/docker-engine/docker.init new file +4 -0
+               ;;
+
+       stop)
+               echo "Stopping $DOCKER_DESC: $BASE"

printf "Stopping docker: "

Review line 68

Quoted 2 lines
(quoted diff) +2 -0
+               start-stop-daemon --stop --pidfile
+ "$DOCKER_SSD_PIDFILE" --retry 10

start-stop-daemon -K -q -p /var/run/docker.pid

Review line 69

Quoted 1 line
(quoted diff) +1 -0
+               echo $?
		[ $? = 0 ] && echo "OK" || echo "FAIL"

package/docker-engine/docker.init line 78

Quoted 9 lines
package/docker-engine/docker.init new file +9 -0
+               ;;
+
+       restart)
+               docker_pid=`cat "$DOCKER_SSD_PIDFILE" 2>/dev/null`
+               [ -n "$docker_pid" ] \
+                       && [ -d /proc/$docker_pid ] \
+                       && $0 stop \
+                       && sleep 1
+               $0 start

Why? Just:

		$0 stop
		$0 start

package/docker-engine/docker.init line 83

Quoted 5 lines
package/docker-engine/docker.init new file +5 -0
+               ;;
+
+       force-reload)
+               $0 restart
+               ;;

Not needed.

package/docker-engine/docker.init line 89

Quoted 6 lines
package/docker-engine/docker.init new file +6 -0
+
+       *)
+               echo "Usage: service docker {start|stop|restart}"
+               exit 1
+               ;;
+esac

Thanks,

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

#7 lore raw

PATCH v9 1/2 package/docker-containerd: bump to latest

In reply to Christian Stewart

Hello,

Quoted 8 lines · Christian Stewart

Bump the pinned docker-containerd version to the latest in advance of the introduction of docker-engine v1.12.0-rc4.

---
 package/docker-containerd/docker-containerd.hash | 2 +-
 package/docker-containerd/docker-containerd.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

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