Skip to contentSkip to conversation

package/tini: restore use as docker-init

PATCH In review Fiona Klute via buildroot 1 participant 4 messages Oct 10, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/tini: restore use as docker-init

From: "Fiona Klute (WIWA)" <[email protected]>

Commit 24cac9c4e6a36fd14b263a8eecf7ae7d58ab5a59 "system: add tini as init system" made BR2_PACKAGE_TINI depend on BR2_INIT_TINI. This is
incorrect: tini is not only needed when building a container image using Buildroot, but also to run Docker containers on Buildroot systems using another another init system, if Docker is configured to provide an init process for the container (e.g. with "docker run --init"). The tini package already provides the "docker-init" symlink required for that.

Example error without tini installed:

$ docker run --rm -ti --init alpine
docker: Error response from daemon: exec: "docker-init": executable file not found in $PATH.
---
 package/tini/Config.in | 1 -
 1 file changed, 1 deletion(-)
package/tini/Config.in +0 -1
index bca8ad8e96..719e1e1f22 100644
@@ -1,7 +1,6 @@
 config BR2_PACKAGE_TINI
 	bool "tini"
 	depends on BR2_USE_MMU # fork()
-	depends on BR2_INIT_TINI
 	help
 	  tini is a simple but valid init binary to
 	  act as PID 1 for containers.

--
2.45.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#1 lore raw

PATCH 2/2 package/docker-engine: add optional dependency on tini

From: "Fiona Klute (WIWA)" <[email protected]>

To provide an init process for containers if requested e.g. with "docker run --init", Docker relies on tini to provide the init binary. package/tini already provides the required /usr/libexec/docker/docker-init symlink, the new option just selects tini if enabled to prevent confusion over why docker-init is missing.

---
Adding an option seems like the least invasive version to me. An unconditional dependency would work too, I'd be surprised if anyone using Docker on the target has an issue with the extra ~66KB. Or drop the patch, being able to install tini (patch 1) is the critical part. ;-)

 package/docker-engine/Config.in | 11 +++++++++++
 1 file changed, 11 insertions(+)
package/docker-engine/Config.in +11 -0
index 49a002a647..e03ecceeff 100644
@@ -48,6 +48,17 @@ config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS
 	help
 	  Build the vfs filesystem driver for Docker.
 
+config BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT
+	bool "support docker-init"
+	select BR2_PACKAGE_TINI # runtime
+	help
+	  Support providing a minimal init process for containers,
+	  using tini. Required to use "docker run --init".
+
+	  This does not change the Docker engine build, the
+	  docker-init symlink is provided by the tini package
+	  itself. This option only adds the dependency.
+
 endif
 
 comment "docker-engine needs a glibc or musl toolchain w/ threads, headers >= 3.17"

--
2.45.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

author Reviewed-by Christian Stewart on v1 1/2
#2 lore raw
In reply to Fiona Klute via buildroot

Hi all,

Quoted 28 lines · Fiona Klute

From: "Fiona Klute (WIWA)" <[email protected]>

Commit 24cac9c4e6a36fd14b263a8eecf7ae7d58ab5a59 "system: add tini as init system" made BR2_PACKAGE_TINI depend on BR2_INIT_TINI. This is
incorrect: tini is not only needed when building a container image using Buildroot, but also to run Docker containers on Buildroot systems using another another init system, if Docker is configured to provide an init process for the container (e.g. with "docker run --init"). The tini package already provides the "docker-init" symlink required for that.

Example error without tini installed:

$ docker run --rm -ti --init alpine
docker: Error response from daemon: exec: "docker-init": executable file
not found in $PATH.
---
 package/tini/Config.in | 1 -
 1 file changed, 1 deletion(-)
package/tini/Config.in +0 -0
index bca8ad8e96..719e1e1f22 100644

package/tini/Config.in line 6

Quoted 7 lines
package/tini/Config.in +0 -1
@@ -1,7 +1,6 @@
 config BR2_PACKAGE_TINI
        bool "tini"
        depends on BR2_USE_MMU # fork()
-       depends on BR2_INIT_TINI
        help
          tini is a simple but valid init binary to
          act as PID 1 for containers.

Agreed

Best regards,
Christian

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Fiona Klute via buildroot
Quoted 13 lines · On Thu, 10 Oct 2024 15:29:11 +0200 Fiona Klute via buildroot…

From: "Fiona Klute (WIWA)" <[email protected]>

Commit 24cac9c4e6a36fd14b263a8eecf7ae7d58ab5a59 "system: add tini as init system" made BR2_PACKAGE_TINI depend on BR2_INIT_TINI. This is
incorrect: tini is not only needed when building a container image using Buildroot, but also to run Docker containers on Buildroot systems using another another init system, if Docker is configured to provide an init process for the container (e.g. with "docker run --init"). The tini package already provides the "docker-init" symlink required for that.

Example error without tini installed:

Quoted 7 lines
$ docker run --rm -ti --init alpine
docker: Error response from daemon: exec: "docker-init": executable file not found in $PATH.
---
 package/tini/Config.in | 1 -
 1 file changed, 1 deletion(-)

Thanks, both applied. On PATCH 2/2, I wasn't 100% sure, but it's simple enough, clarifies this dependency that isn't entirely obvious, and can always be reworked/reverted if other people think it wasn't the right solution.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot