diff mbox series

[1/6] tini: new package

Message ID 20180715010732.21765-1-christian@paral.in
State Superseded
Headers show
Series [1/6] tini: new package | expand

Commit Message

Christian Stewart July 15, 2018, 1:07 a.m. UTC
Tini is a minimal init process to act as PID 1 for containers.

Tini can be used to satisfy docker-engine's docker-init binary
requirement.

Signed-off-by: Christian Stewart <christian@paral.in>

---

Changes since v2:

 - Upgraded to v0.17.0
 - Added hash for license file
---
 package/Config.in      |  1 +
 package/tini/Config.in | 16 ++++++++++++++++
 package/tini/tini.hash |  3 +++
 package/tini/tini.mk   | 35 +++++++++++++++++++++++++++++++++++
 4 files changed, 55 insertions(+)
 create mode 100644 package/tini/Config.in
 create mode 100644 package/tini/tini.hash
 create mode 100644 package/tini/tini.mk

Comments

Yann E. MORIN July 15, 2018, 3:57 p.m. UTC | #1
Christian, All,

On 2018-07-14 18:07 -0700, Christian Stewart spake thusly:
> Tini is a minimal init process to act as PID 1 for containers.
> 
> Tini can be used to satisfy docker-engine's docker-init binary
> requirement.
> 
> Signed-off-by: Christian Stewart <christian@paral.in>
[--SNIP--]
> diff --git a/package/tini/tini.mk b/package/tini/tini.mk
> new file mode 100644
> index 0000000000..9f9d986745
> --- /dev/null
> +++ b/package/tini/tini.mk
> @@ -0,0 +1,35 @@
> +################################################################################
> +#
> +# tini
> +#
> +################################################################################
> +
> +TINI_VERSION = v0.17.0
> +TINI_SITE = $(call github,krallin,tini,$(TINI_VERSION))
> +
> +TINI_LICENSE = MIT
> +TINI_LICENSE_FILES = LICENSE
> +
> +TINI_CFLAGS = $(TARGET_CFLAGS) -DTINI_VERSION=\"$(TINI_VERSION)\" -DTINI_GIT=\"\"
> +TINI_CFLAGS += -static

I know the rationale behind doing a static build here. However, I ahve a
more profound concern. Lemme explain:

If you are going to be runnin "something" inside a docker-based container,
surely you will have to provide said "something". Probalby a system on
its own, build with Buildroot, or not.

So, why would not that system provide its own init process, how complex
might it ever be (ranging from the simplest like tini, to a full-blown
systemd for example).

So, why would it be the responsibility of the host system to provide the
init program, rather that the responsibility of the guest system?

Note that I did not say we did not want tini. We do want it so that we
can build an image that can later server as a guest, bringing its own
tini (or dumb-init or whatever).

So, I still question the reason to have tini built as a static binary,
provided from the host to the guest...

Regards,
Yann E. MORIN.

> +ifeq ($(BR2_PACKAGE_TINI_MINIMAL),y)
> +TINI_CFLAGS += -DTINI_MINIMAL
> +endif
> +
> +define TINI_CONFIGURE_CMDS
> +	printf "#pragma once\n" > $(@D)/src/tiniConfig.h
> +endef
> +
> +define TINI_BUILD_CMDS
> +	$(TARGET_CC) \
> +		$(TINI_CFLAGS) \
> +		-o $(@D)/tini $(@D)/src/tini.c
> +endef
> +
> +define TINI_INSTALL_TARGET_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/tini $(TARGET_DIR)/usr/bin/tini
> +endef
> +
> +# Tini's CMakeLists.txt is not suitable for Buildroot.
> +$(eval $(generic-package))
> -- 
> 2.16.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Matt Weber Aug. 10, 2018, 1:53 p.m. UTC | #2
Christian,
On Sat, Jul 14, 2018 at 8:15 PM Christian Stewart <christian@paral.in> wrote:
>
> Tini is a minimal init process to act as PID 1 for containers.
>
> Tini can be used to satisfy docker-engine's docker-init binary
> requirement.
>
> Signed-off-by: Christian Stewart <christian@paral.in>

I see this patch is in a "Not Applicable" state.  This package is
useful as a minimal init in the most basic of LXC containers (cases
where docker is overkill).  Our use case had the rootfs being shared
with the container and this init could remain dyn linked.

I couldn't see a clear path in the thread on next steps.  I'm glad to
respin with an update.

Tested-by: Matt Weber <matthew.weber@rockwellcollins.com>
Christian Stewart Aug. 10, 2018, 10:36 p.m. UTC | #3
Thomas,

On Fri, Aug 10, 2018 at 6:54 AM Matthew Weber
<matthew.weber@rockwellcollins.com> wrote:
> On Sat, Jul 14, 2018 at 8:15 PM Christian Stewart <christian@paral.in> wrote:
> > Tini is a minimal init process to act as PID 1 for containers.
>
> I see this patch is in a "Not Applicable" state.  This package is
> useful as a minimal init in the most basic of LXC containers (cases
> where docker is overkill).  Our use case had the rootfs being shared
> with the container and this init could remain dyn linked.
>
> I couldn't see a clear path in the thread on next steps.  I'm glad to
> respin with an update.

Docker is now taking a more direct approach to dealing with process
reaping and other concerns Tini was previously used to address.
Regardless; the intent of adding Tini is not to satisfy a Docker
requirement.

Best,
Christian
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index 20fe5ad8ff..9d657287cd 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1983,6 +1983,7 @@  comment "Utilities"
 	source "package/sudo/Config.in"
 	source "package/terminology/Config.in"
 	source "package/time/Config.in"
+	source "package/tini/Config.in"
 	source "package/tmux/Config.in"
 	source "package/which/Config.in"
 	source "package/xmlstarlet/Config.in"
diff --git a/package/tini/Config.in b/package/tini/Config.in
new file mode 100644
index 0000000000..235fc1a8fb
--- /dev/null
+++ b/package/tini/Config.in
@@ -0,0 +1,16 @@ 
+config BR2_PACKAGE_TINI
+	bool "tini"
+	help
+	  tini is a simple but valid init binary to
+	  act as PID 1 for containers.
+
+	  https://github.com/krallin/tini
+
+if BR2_PACKAGE_TINI
+
+config BR2_PACKAGE_TINI_MINIMAL
+	bool "build minimal variant"
+	help
+	  Disables argument parsing and verbose output.
+
+endif
diff --git a/package/tini/tini.hash b/package/tini/tini.hash
new file mode 100644
index 0000000000..c4f85c43b0
--- /dev/null
+++ b/package/tini/tini.hash
@@ -0,0 +1,3 @@ 
+# Locally computed
+sha256	5244691718f6856db74dcf6dbb3576a901e737f41412e7895747f0ccb4ccaff0	tini-v0.17.0.tar.gz
+sha256	e5f46bca81266bdd511cf08018d66866870531794569c04f9b45f50dd23c28b0	LICENSE
diff --git a/package/tini/tini.mk b/package/tini/tini.mk
new file mode 100644
index 0000000000..9f9d986745
--- /dev/null
+++ b/package/tini/tini.mk
@@ -0,0 +1,35 @@ 
+################################################################################
+#
+# tini
+#
+################################################################################
+
+TINI_VERSION = v0.17.0
+TINI_SITE = $(call github,krallin,tini,$(TINI_VERSION))
+
+TINI_LICENSE = MIT
+TINI_LICENSE_FILES = LICENSE
+
+TINI_CFLAGS = $(TARGET_CFLAGS) -DTINI_VERSION=\"$(TINI_VERSION)\" -DTINI_GIT=\"\"
+TINI_CFLAGS += -static
+
+ifeq ($(BR2_PACKAGE_TINI_MINIMAL),y)
+TINI_CFLAGS += -DTINI_MINIMAL
+endif
+
+define TINI_CONFIGURE_CMDS
+	printf "#pragma once\n" > $(@D)/src/tiniConfig.h
+endef
+
+define TINI_BUILD_CMDS
+	$(TARGET_CC) \
+		$(TINI_CFLAGS) \
+		-o $(@D)/tini $(@D)/src/tini.c
+endef
+
+define TINI_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/tini $(TARGET_DIR)/usr/bin/tini
+endef
+
+# Tini's CMakeLists.txt is not suitable for Buildroot.
+$(eval $(generic-package))