Ver código fonte

package/docker-engine: add option to support catatonit as init

currently, docker-engine can only use tini as injected init. catatonit
as a package exists, but it does not create the symlink that would be
needed at runtime [0].

Add a choice at the docker-engine level, for which injected init to use,
bringing catatonit to the integration level of tini.

[0] that could be done in a post-build script, but that's not practical.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Christian Stewart <christian@aperture.us>
Cc: Fiona Klute (WIWA) <fiona.klute@gmx.de>
Tested-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
[Julien: move the legacy option to a new 2025.05 section]
Signed-off-by: Julien Olivain <ju.o@free.fr>
Yann E. MORIN 5 meses atrás
pai
commit
022f49618c

+ 11 - 0
Config.in.legacy

@@ -144,6 +144,17 @@ endif
 
 ###############################################################################
 
+comment "Legacy options removed in 2025.05"
+
+# BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT is still referenced in docker-engine
+config BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT
+	bool "docker-engine init support is now a choice"
+	select BR2_LEGACY
+	help
+	  docker-engine init support is now a choice. The original
+	  setting has been adapted; be sure to review it in the
+	  docker-engine package.
+
 comment "Legacy options removed in 2025.02"
 
 config BR2_PACKAGE_ANGULARJS

+ 27 - 5
package/docker-engine/Config.in

@@ -48,16 +48,38 @@ config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS
 	help
 	  Build the vfs filesystem driver for Docker.
 
-config BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT
+choice
 	bool "support docker-init"
+	default BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT_TINI if BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT  # legacy
+	help
+	  Support providing a minimal init process for containers.
+	  Required to use "docker run --init".
+
+config BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT_NONE
+	bool "none"
+	help
+	  Do not support docker-init.
+
+config BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT_CATATONIT
+	bool "catatonit"
+	select BR2_PACKAGE_CATATONIT # runtime
+	help
+	  Support providing a minimal init process for containers,
+	  using catatonit.
+
+config BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT_TINI
+	bool "tini"
 	select BR2_PACKAGE_TINI # runtime
 	help
 	  Support providing a minimal init process for containers,
-	  using tini. Required to use "docker run --init".
+	  using tini.
+
+endchoice
 
-	  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.
+config BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT_NAME
+	string
+	default "tini" if BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT_TINI
+	default "catatonit" if BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT_CATATONIT
 
 endif
 

+ 4 - 2
package/docker-engine/docker-engine.mk

@@ -35,10 +35,12 @@ DOCKER_ENGINE_DEPENDENCIES += systemd
 DOCKER_ENGINE_TAGS += systemd journald
 endif
 
-ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT),y)
+DOCKER_ENGINE_INIT_NAME = $(call qstrip,$(BR2_PACKAGE_DOCKER_ENGINE_DOCKER_INIT_NAME))
+ifneq ($(DOCKER_ENGINE_INIT_NAME),)
 define DOCKER_ENGINE_INIT
 	mkdir -p $(TARGET_DIR)/usr/libexec/docker
-	ln -sf ../../bin/tini $(TARGET_DIR)/usr/libexec/docker/docker-init
+	ln -sf ../../bin/$(DOCKER_ENGINE_INIT_NAME) \
+		$(TARGET_DIR)/usr/libexec/docker/docker-init
 endef
 DOCKER_ENGINE_POST_INSTALL_TARGET_HOOKS += DOCKER_ENGINE_INIT
 endif