Message ID | 1469220779-31430-2-git-send-email-christian@paral.in |
---|---|
State | Superseded |
Headers | show |
Hello, On Fri, 22 Jul 2016 13:52:59 -0700, Christian Stewart wrote: > diff --git a/package/Config.in b/package/Config.in > index 6a84f9f..c871e63 100644 > --- a/package/Config.in > +++ b/package/Config.in > @@ -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 ? > source "package/dsp-tools/Config.in" > source "package/efibootmgr/Config.in" > source "package/efivar/Config.in" > diff --git a/package/docker-engine/Config.in b/package/docker-engine/Config.in > new file mode 100644 > index 0000000..82cd251 > --- /dev/null > +++ b/package/docker-engine/Config.in > @@ -0,0 +1,69 @@ > +config BR2_PACKAGE_DOCKER_ENGINE > + bool "docker-engine" > + depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS > + depends on BR2_TOOLCHAIN_HAS_THREADS > + 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" > + 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" > + 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. > + select BR2_PACKAGE_SQLITE # docker-engine: runtime dependency The comment should just be "# runtime dependency" > diff --git a/package/docker-engine/docker-engine.hash b/package/docker-engine/docker-engine.hash > new file mode 100644 > index 0000000..1de09f8 > --- /dev/null > +++ b/package/docker-engine/docker-engine.hash > @@ -0,0 +1,2 @@ > +# Locally calculated > +sha256 bc256d2a348efbf236eab991254c925fa1917dd1e29cb40586f1696f4e24852e docker-engine-v1.12.0-rc4.tar.gz > diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk > new file mode 100644 > index 0000000..9b0977d > --- /dev/null > +++ b/package/docker-engine/docker-engine.mk > @@ -0,0 +1,119 @@ > +################################################################################ > +# > +# docker-engine > +# > +################################################################################ > + > +DOCKER_ENGINE_VERSION = v1.12.0-rc4 > +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. > + 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. > + 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 > + > +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y) > +DOCKER_ENGINE_BUILD_TAGS += daemon Add: DOCKER_ENGINE_BUILD_TARGETS += dockerd > +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 > + > +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). > + > +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 > + > +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) ) > +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) ) > +++ b/package/docker-engine/docker.init Should be named S61docker > @@ -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. > +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. > + > +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 > + ( > + 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 ? > +} > + > +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: " > + 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 > + -- \ > + -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. > + echo $? Replace with: [ $? = 0 ] && echo "OK" || echo "FAIL" > + ;; > + > + stop) > + echo "Stopping $DOCKER_DESC: $BASE" printf "Stopping docker: " > + start-stop-daemon --stop --pidfile "$DOCKER_SSD_PIDFILE" --retry 10 start-stop-daemon -K -q -p /var/run/docker.pid > + echo $? [ $? = 0 ] && echo "OK" || echo "FAIL" > + ;; > + > + 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 > + ;; > + > + force-reload) > + $0 restart > + ;; Not needed. > + > + *) > + echo "Usage: service docker {start|stop|restart}" > + exit 1 > + ;; > +esac Thanks, Thomas
Thomas, Init scripts were written by Andrew so I will let him take those revisions. On Sun, Jul 24, 2016, 6:29 AM Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > The comment should just be "# runtime dependency" Okay, acknowledged. > 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." > If you use CGO, then docker needs to also depend on > BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS, see docker-containerd. Added, thanks. > 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. > 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) > ) > > > +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) > ) > Changed, thanks. > > +++ b/package/docker-engine/docker.init > > Should be named S61docker Changed, thanks. > > > @@ -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
Hello, On Sun, 24 Jul 2016 12:13:30 -0700, Christian Stewart wrote: > 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. > > 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. > > If you use CGO, then docker needs to also depend on > > BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS, see docker-containerd. > > Added, thanks. > > > 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
Thomas, On Sun, Jul 24, 2016 at 12:31 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > On Sun, 24 Jul 2016 12:13:30 -0700, Christian Stewart wrote: > >> 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. > 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
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 > From: Thomas Petazzoni [mailto:thomas.petazzoni@free-electrons.com] > Sent: Sunday, July 24, 2016 9:29 AM > > +++ b/package/docker-engine/docker.init > > Should be named S61docker > > > @@ -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. > > > +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. > > > + > > +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 > > + ( > > + 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 ? > > > +} > > + > > +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: " > > > + 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 > > > + -- \ > > + -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. > > > + echo $? > > Replace with: > > [ $? = 0 ] && echo "OK" || echo "FAIL" > > > + ;; > > + > > + stop) > > + echo "Stopping $DOCKER_DESC: $BASE" > > printf "Stopping docker: " > > > + start-stop-daemon --stop --pidfile > > + "$DOCKER_SSD_PIDFILE" --retry 10 > > start-stop-daemon -K -q -p /var/run/docker.pid > > > + echo $? > > [ $? = 0 ] && echo "OK" || echo "FAIL" > > > + ;; > > + > > + 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 > > > + ;; > > + > > + force-reload) > > + $0 restart > > + ;; > > Not needed. > > > + > > + *) > > + 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
diff --git a/package/Config.in b/package/Config.in index 6a84f9f..c871e63 100644 --- a/package/Config.in +++ b/package/Config.in @@ -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" diff --git a/package/docker-engine/Config.in b/package/docker-engine/Config.in new file mode 100644 index 0000000..82cd251 --- /dev/null +++ b/package/docker-engine/Config.in @@ -0,0 +1,69 @@ +config BR2_PACKAGE_DOCKER_ENGINE + bool "docker-engine" + depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS + depends on BR2_TOOLCHAIN_HAS_THREADS + 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" + depends on BR2_USE_MMU # docker-containerd + depends on BR2_USE_WCHAR # docker-containerd + select BR2_PACKAGE_DOCKER_CONTAINERD # docker-containerd: runtime dependency + 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 + select BR2_PACKAGE_SQLITE # docker-engine: runtime dependency + 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 + +comment "docker-engine needs a toolchain w/ threads" + depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS + depends on !BR2_TOOLCHAIN_HAS_THREADS diff --git a/package/docker-engine/docker-engine.hash b/package/docker-engine/docker-engine.hash new file mode 100644 index 0000000..1de09f8 --- /dev/null +++ b/package/docker-engine/docker-engine.hash @@ -0,0 +1,2 @@ +# Locally calculated +sha256 bc256d2a348efbf236eab991254c925fa1917dd1e29cb40586f1696f4e24852e docker-engine-v1.12.0-rc4.tar.gz diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk new file mode 100644 index 0000000..9b0977d --- /dev/null +++ b/package/docker-engine/docker-engine.mk @@ -0,0 +1,119 @@ +################################################################################ +# +# docker-engine +# +################################################################################ + +DOCKER_ENGINE_VERSION = v1.12.0-rc4 +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 \ + CGO_NO_EMULATION=1 \ + GOBIN="$(@D)/bin" \ + GOPATH="$(DOCKER_ENGINE_GOPATH)" \ + CPATH=$$CPATH:$(TARGET_DIR)/usr/include/ \ + 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 + +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 + 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 + +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 + +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 + +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) +endef + +define DOCKER_ENGINE_INSTALL_TARGET_CMDS + $(DOCKER_ENGINE_INSTALL_TARGET_CLIENT_CMDS) + $(DOCKER_ENGINE_INSTALL_TARGET_DAEMON_CMDS) +endef + +$(eval $(generic-package)) diff --git a/package/docker-engine/docker.init b/package/docker-engine/docker.init new file mode 100644 index 0000000..99c38b7 --- /dev/null +++ b/package/docker-engine/docker.init @@ -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 +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 + +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 + ( + cd /sys/fs/cgroup + for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do + mkdir -p $sys + if ! mountpoint -q $sys; then + if ! mount -n -t cgroup -o $sys cgroup $sys; then + rmdir $sys || true + fi + fi + done + ) +} + +case "$1" in + start) + cgroupfs_mount + + ulimit -n 1048576 + ulimit -p 1048576 + + 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 $? + ;; + + 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" ] \ + && [ -d /proc/$docker_pid ] \ + && $0 stop \ + && sleep 1 + $0 start + ;; + + force-reload) + $0 restart + ;; + + *) + echo "Usage: service docker {start|stop|restart}" + exit 1 + ;; +esac