docker-ce: Added Docker community edition
authorGerard Ryan <redacted>
Sun, 14 Oct 2018 03:18:43 +0000 (13:18 +1000)
committerYousong Zhou <redacted>
Thu, 4 Jul 2019 11:35:15 +0000 (19:35 +0800)
Signed-off-by: Gerard Ryan <redacted>
utils/docker-ce/Config.in [new file with mode: 0644]
utils/docker-ce/Makefile [new file with mode: 0644]
utils/docker-ce/files/dockerd.init [new file with mode: 0644]
utils/docker-ce/patches/001-libdevmapper_name_fix.patch [new file with mode: 0644]

diff --git a/utils/docker-ce/Config.in b/utils/docker-ce/Config.in
new file mode 100644 (file)
index 0000000..5c6428e
--- /dev/null
@@ -0,0 +1,84 @@
+if PACKAGE_docker-ce
+       config DOCKER_KERNEL_OPTIONS
+               bool "Enable Basic kernel support for Docker"
+               default n
+               select KERNEL_CGROUPS
+               select KERNEL_CGROUP_CPUACCT
+               select KERNEL_CGROUP_SCHED
+               select KERNEL_NAMESPACES
+               select KERNEL_CPUSETS
+               select KERNEL_MEMCG
+               select KERNEL_KEYS
+               select KERNEL_LXC_MISC
+               select KERNEL_POSIX_MQUEUE
+               help
+                 Select needed kernel options for Docker. Options include
+                 cgroups, namespaces and other miscellaneous options.
+                 see also https://github.com/docker/engine/blob/master/contrib/check-config.sh
+
+       config DOCKER_SECCOMP
+               bool "Enable support for seccomp in Docker"
+               default n
+               select KERNEL_SECCOMP
+               select PACKAGE_libseccomp
+               help
+                 Build Docker with support for seccomp filters.
+                 Select libseccomp which also pulls-in the needed kernel features.
+
+       config DOCKER_RES_SHAPE
+               bool "Enables support for resource shaping"
+               default n
+               select KERNEL_MEMCG_SWAP
+               select KERNEL_MEMCG_SWAP_ENABLED
+               select KERNEL_BLK_DEV_THROTTLING
+               select KERNEL_CGROUP_PERF
+               select KERNEL_FAIR_GROUP_SCHED
+               select KERNEL_CFS_BANDWIDTH
+               select KERNEL_RT_GROUP_SCHED
+
+       menu "Network"
+               config DOCKER_NET_OVERLAY
+                       bool "Enables the Overlay network feature"
+                       default n
+                       select PACKAGE_kmod-udptunnel4
+                       help
+                         Selects kernel options for the Overlay network feature.
+                         Includes udptunnel4
+
+               config DOCKER_NET_ENCRYPT
+                       bool "Enable encrypted networking kernel support"
+                       depends on DOCKER_NET_OVERLAY
+                       default n
+                       select PACKAGE_kmod-ipsec
+                       select PACKAGE_kmod-ipsec4
+                       select PACKAGE_kmod-crypto-gcm
+                       select PACKAGE_kmod-crypto-ghash
+                       help
+                         Select needed kernel options for encrypted networking support.
+
+               config DOCKER_NET_MACVLAN
+                       bool "Enables macvlan kernel support"
+                       default n
+                       select PACKAGE_kmod-macvlan
+                       select PACKAGE_kmod-dummy
+
+               config DOCKER_NET_TFTP
+                       bool "Enable ftp/tftp client kernel support"
+                       default n
+                       select PACKAGE_kmod-nf-nathelper
+                       select PACKAGE_kmod-nf-nathelper-extra
+       endmenu
+
+       menu "Storage"
+               config DOCKER_STO_EXT4
+                       bool "Enables support for ext3 or ext4 as the backing filesystem"
+                       default n
+                       select KERNEL_EXT4_FS_POSIX_ACL
+
+               config DOCKER_STO_BTRFS
+                       bool "Enables support for btrfs as the backing filesystem"
+                       default n
+                       select PACKAGE_kmod-fs-btrfs
+                       select KERNEL_BTRFS_FS_POSIX_ACL
+       endmenu
+endif
diff --git a/utils/docker-ce/Makefile b/utils/docker-ce/Makefile
new file mode 100644 (file)
index 0000000..3ba2c82
--- /dev/null
@@ -0,0 +1,107 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=docker-ce
+PKG_VERSION:=18.09.6
+PKG_RELEASE:=1
+PKG_LICENSE:=Apache-2.0
+PKG_LICENSE_FILES:=components/cli/LICENSE components/engine/LICENSE
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/docker/docker-ce/tar.gz/v$(PKG_VERSION)?
+PKG_HASH:=e8d2dd41e09e838e9043d4a5cf8433d8860afa20a611025621f7817b7ab16012
+PKG_SOURCE_VERSION:=481bc77156
+
+PKG_MAINTAINER:=Gerard Ryan <G.M0N3Y.2503@gmail.com>
+
+PKG_BUILD_DEPENDS:=golang/host
+PKG_BUILD_PARALLEL:=1
+
+GO_PKG:=github.com/docker
+
+include $(INCLUDE_DIR)/package.mk
+include ../../lang/golang/golang-package.mk
+
+define Package/docker-ce/config
+  source "$(SOURCE)/Config.in"
+endef
+
+define Package/docker-ce
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Docker Community Edition
+  URL:=https://www.docker.com/
+  DEPENDS:=$(GO_ARCH_DEPENDS) @TARGET_x86_64 +btrfs-progs +libdevmapper +containerd +cgroupfs-mount +ca-certificates +iptables-mod-extra +DOCKER_SECCOMP:libseccomp \
+           +kmod-ikconfig +kmod-veth +kmod-br-netfilter +kmod-nf-ipvs
+  USERID:=docker:docker
+  MENU:=1
+endef
+
+define Package/docker-ce/description
+  Docker Engine is used by millions enables containerized applications
+  to run anywhere consistently on any infrastructure.
+endef
+
+define Build/Configure
+       # move so GoPackage/Build/Configure will get the correct path
+       mv $(PKG_BUILD_DIR)/components/engine $(PKG_BUILD_DIR)/
+       mv $(PKG_BUILD_DIR)/components/cli $(PKG_BUILD_DIR)/
+
+       # docker generates files at build time so we'll just symlink for now and call GoPackage/Build/Configure later
+       mkdir -p $(GO_PKG_BUILD_DIR)/bin \
+                        $(GO_PKG_BUILD_DIR)/src \
+                        $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/ \
+                        $(GO_PKG_CACHE_DIR) \
+                        $(GO_PKG_TMP_DIR)
+       $(LN) $(PKG_BUILD_DIR)/cli $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/cli
+       $(LN) $(PKG_BUILD_DIR)/engine $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/docker
+endef
+
+ifeq ($(CONFIG_DOCKER_SECCOMP),y)
+BUILDTAGS:=seccomp
+else
+BUILDTAGS:=
+endif
+
+define Build/Compile
+       ( \
+               export GOPATH=$(GO_PKG_BUILD_DIR) \
+                       GOCACHE=$(GO_PKG_CACHE_DIR) \
+                       GOTMPDIR=$(GO_PKG_TMP_DIR) \
+                       GOROOT_FINAL=$(GO_TARGET_ROOT) \
+                       CC=$(TARGET_CC) \
+                       CXX=$(TARGET_CXX) \
+                       $(call GoPackage/Environment) \
+                       GITCOMMIT=$(PKG_SOURCE_VERSION) \
+                       DOCKER_GITCOMMIT=$(PKG_SOURCE_VERSION) \
+                       DOCKER_BUILDTAGS='$(BUILDTAGS)' \
+                       VERSION=$(PKG_VERSION) \
+               \
+               && echo "Compiling CLI..." \
+               && cd $(PKG_BUILD_DIR)/cli \
+               && ./scripts/build/binary \
+               \
+               && echo "Compiling Engine..." \
+               && cd $(PKG_BUILD_DIR)/engine \
+               && ./hack/make.sh binary \
+       )
+
+       # done here to include autogenerated files also
+       rm $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/cli
+       rm $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/docker
+       $(call GoPackage/Build/Configure)
+endef
+
+define Package/docker-ce/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/cli/build/docker $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/engine/bundles/binary-daemon/dockerd $(1)/usr/bin/
+
+       $(INSTALL_DIR) $(1)/opt/docker/
+       $(INSTALL_DIR) $(1)/usr/share/docker/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/engine/contrib/check-config.sh $(1)/usr/share/docker/
+
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/dockerd.init $(1)/etc/init.d/dockerd
+endef
+
+$(eval $(call BuildPackage,docker-ce))
diff --git a/utils/docker-ce/files/dockerd.init b/utils/docker-ce/files/dockerd.init
new file mode 100644 (file)
index 0000000..bf1bd8a
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common
+
+USE_PROCD=1
+START=25
+
+# docker can't run with a symlink in the path so we just use /opt/docker/
+start_service() {
+       procd_open_instance
+       procd_set_param command /usr/bin/dockerd -g /opt/docker/
+       procd_close_instance
+}
diff --git a/utils/docker-ce/patches/001-libdevmapper_name_fix.patch b/utils/docker-ce/patches/001-libdevmapper_name_fix.patch
new file mode 100644 (file)
index 0000000..eb7340d
--- /dev/null
@@ -0,0 +1,13 @@
+Index: docker-ce-18.09.0/components/engine/hack/make.sh
+===================================================================
+--- docker-ce-18.09.0.orig/components/engine/hack/make.sh
++++ docker-ce-18.09.0/components/engine/hack/make.sh
+@@ -129,7 +129,7 @@ fi
+ # with a newer libdevmapper than the one it was built with.
+ if \
+       command -v gcc &> /dev/null \
+-      && ! ( echo -e  '#include <libdevmapper.h>\nint main() { dm_task_deferred_remove(NULL); }'| gcc -xc - -o /dev/null $(pkg-config --libs devmapper) &> /dev/null ) \
++      && ! ( echo -e  '#include <libdevmapper.h>\nint main() { dm_task_deferred_remove(NULL); }'| gcc -xc - -o /dev/null $(pkg-config --libs libdevmapper) &> /dev/null ) \
+ ; then
+       add_buildtag libdm dlsym_deferred_remove
+ fi
git clone https://git.99rst.org/PROJECT