From patchwork Thu Oct 19 00:22:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Stewart X-Patchwork-Id: 827890 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=paral-in.20150623.gappssmtp.com header.i=@paral-in.20150623.gappssmtp.com header.b="Rf31/Wfe"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yHVGR3ZZFz9t6x for ; Thu, 19 Oct 2017 11:31:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 91CAA88A56; Thu, 19 Oct 2017 00:31:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aVG73mghOQIt; Thu, 19 Oct 2017 00:31:07 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 71225889EF; Thu, 19 Oct 2017 00:31:07 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id B5D0C1CE75C for ; Thu, 19 Oct 2017 00:31:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B04C787E8D for ; Thu, 19 Oct 2017 00:31:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3zPbH8_LPGcV for ; Thu, 19 Oct 2017 00:31:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 1C53487894 for ; Thu, 19 Oct 2017 00:31:06 +0000 (UTC) Received: by mail-io0-f170.google.com with SMTP id e89so8145271ioi.11 for ; Wed, 18 Oct 2017 17:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paral-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L6MEXkn4EfxnP84XNUgHFLCJIGHoHDuaM6mVnXt6YiQ=; b=Rf31/Wfe1dikCjpClkJx0smk4p29aiBKvNg+eFCkDTh8yFggKKquyJ7VYN6ZeuDyUc vz/a04y4yBKFVcB49ckkWtz21yW7U2MrOOpP622ruuTZ9pkR16TDmTWuxlqNf4HXGbkr +iFwq/5lt4lpVRttvchf0wkD3vAWdPWz7h6rS5fZHcNDreZ59UsFbspdoNpwxBZb/Ick Bsdg6h8nu0KKW3N5EuacfbxZTs4F/uVFEY0YlvY8Qu1DVrDmAEh4H+J7zN+fuocuitDu hdAM8R1rjRSGsxKlFtuTOEyegl3hN4002JnLogaETqC4ZROcc6XQZT3NWmRKWs6gI0AI govQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L6MEXkn4EfxnP84XNUgHFLCJIGHoHDuaM6mVnXt6YiQ=; b=nZAmwal1IT+s3Utxs7AZTD55U/3Vlf7ZEfhHGpm65YWF0aT1CkWcmFyWCCoVlW2dlf ksK8sXzx4mH+cZJnmVGlrjp8IgirIAHOTXaBj5i2ohSMUtaU1FEYgxn/O4kcmcQOoe5D fYGek/jlD+m1burf0jHLgbZijZRN3r/dYf/iD/x/HuAnmG8V5MYY6e4nGRZQzjA2L9Q3 AAMzl/KLlddgENCjc/pFqrjAEA+2HxaGuqRUser/w1T652N0OK/nCLRoQt09ykSLTPGq Vmm40K9umARnWbj4B3gHwrfEYD0C0jjx01/HEIXi62pG3AYt1W1z8fER4qjROOIRzp6g usMQ== X-Gm-Message-State: AMCzsaVNUfWNY1tJIM6ABbT4kI7IUUcJMd3dSBZbCbzMQjBrjBsV1rJQ xVr/xWL3SiuXpZqtu0al0xWuONNq X-Google-Smtp-Source: ABhQp+TxdvBZA77/vxyePyysjjtEcprnGBrlWYo6PYM73a8k+qZrLs9WuJzVoXT8dACR6ZFsDxCdKQ== X-Received: by 10.107.222.17 with SMTP id v17mr382381iog.283.1508372586799; Wed, 18 Oct 2017 17:23:06 -0700 (PDT) Received: from localhost.localdomain (69-174-167-231.lfytina2.metronetinc.net. [69.174.167.231]) by smtp.gmail.com with ESMTPSA id w136sm89624ita.36.2017.10.18.17.23.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Oct 2017 17:23:06 -0700 (PDT) From: Christian Stewart To: buildroot@buildroot.org Date: Wed, 18 Oct 2017 20:22:48 -0400 Message-Id: <20171019002257.27646-3-christian@paral.in> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171019002257.27646-1-christian@paral.in> References: <20171019002257.27646-1-christian@paral.in> Cc: Christian Stewart , fontaine.fabrice@gmail.com Subject: [Buildroot] [PATCH 03/12] docker-engine: add support for init processes X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" When a docker container is run with the --init flag, the Docker engine uses the docker-init binary as PID 1 inside the container. This is necessary in may cases to avoid issues with signal handling, zombie processes, and other quirks when running as PID 1. The docker-init binary is backed by tini on default, but optionally can be changed to docker-init by user preference. Furthermore, this patch fixes the following Docker error: dockerd: level=warning msg="failed to retrieve docker-init version" Signed-off-by: Christian Stewart --- package/docker-engine/Config.in | 26 ++++++++++++++++++++++++++ package/docker-engine/docker-engine.mk | 11 +++++++++++ 2 files changed, 37 insertions(+) diff --git a/package/docker-engine/Config.in b/package/docker-engine/Config.in index 05670a716e..7d9a87f7bb 100644 --- a/package/docker-engine/Config.in +++ b/package/docker-engine/Config.in @@ -33,6 +33,32 @@ config BR2_PACKAGE_DOCKER_ENGINE_STATIC_CLIENT if BR2_PACKAGE_DOCKER_ENGINE_DAEMON +choice + bool "docker-init to use" + default BR2_PACKAGE_DOCKER_ENGINE_INIT_TINI + help + The docker engine uses a minimal init process as PID 1 + inside containers. There are several implementations + of this init process. + +config BR2_PACKAGE_DOCKER_ENGINE_INIT_TINI + bool "tini" + select BR2_PACKAGE_TINI + help + Use Tini as the container init process. + + https://github.com/krallin/tini + +config BR2_PACKAGE_DOCKER_ENGINE_INIT_DUMB_INIT + bool "dumb-init" + select BR2_PACKAGE_DUMB_INIT + help + Use dumb-init as the container init process. + + https://github.com/Yelp/dumb-init + +endchoice + config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS bool "btrfs filesystem driver" depends on BR2_USE_MMU # btrfs-progs diff --git a/package/docker-engine/docker-engine.mk b/package/docker-engine/docker-engine.mk index 8928f072e7..a2776ed78c 100644 --- a/package/docker-engine/docker-engine.mk +++ b/package/docker-engine/docker-engine.mk @@ -50,6 +50,13 @@ endif ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y) DOCKER_ENGINE_BUILD_TAGS += daemon DOCKER_ENGINE_BUILD_TARGETS += dockerd + +ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_INIT_DUMB_INIT),y) +DOCKER_ENGINE_INIT = dumb-init +else +DOCKER_ENGINE_INIT = tini +endif + endif ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_EXPERIMENTAL),y) @@ -119,6 +126,10 @@ define DOCKER_ENGINE_INSTALL_TARGET_CMDS $(foreach target,$(DOCKER_ENGINE_BUILD_TARGETS), \ $(INSTALL) -D -m 0755 $(@D)/bin/$(target) $(TARGET_DIR)/usr/bin/$(target) ) + + $(if $(filter $(BR2_PACKAGE_DOCKER_ENGINE_DAEMON),y), \ + ln -fs $(DOCKER_ENGINE_INIT) $(TARGET_DIR)/usr/bin/docker-init + ) endef $(eval $(generic-package))