From patchwork Wed May 10 02:51:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Stewart X-Patchwork-Id: 760395 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wN1395kHSz9ryb for ; Wed, 10 May 2017 12:51:33 +1000 (AEST) 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="h020b9rA"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D546288568; Wed, 10 May 2017 02:51:29 +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 LejRPuOUMZqp; Wed, 10 May 2017 02:51:25 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 0881388475; Wed, 10 May 2017 02:51:25 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 50C411C01DA for ; Wed, 10 May 2017 02:51:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7DFDB26DB4 for ; Wed, 10 May 2017 02:51:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G3cK9MGDduvx for ; Wed, 10 May 2017 02:51:15 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f182.google.com (mail-pf0-f182.google.com [209.85.192.182]) by silver.osuosl.org (Postfix) with ESMTPS id 56BBF25DDE for ; Wed, 10 May 2017 02:51:15 +0000 (UTC) Received: by mail-pf0-f182.google.com with SMTP id e64so8947867pfd.1 for ; Tue, 09 May 2017 19:51:15 -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=tdBXHutzuM0KAhW6gQbcRV3uofOs2zGK24vMcRPKSq4=; b=h020b9rA+3+y8KCVW4FYR2HOKcnKWFVj6G3Q9AaFTQoL60we357170XIPmm9E7QNHP qmIt4n/tVSYiKeFVRDRpTY+v3PurOT0Igz3PPDPowo0yd7b3/4n9cgftMtPQAK/pfVU7 kVJv9bRaO+2H9bgR8pOyOMZXWK5JPwYVl6f/VH352QFp4LkUL85obAmdT6ymYg7BJKrw 91+5MTiSeG11hlF40b6bcoeFfh+LUHDV9yCDyR8R/eq1EhH8T8NM2GnxtSjqczodAsEs MVdeHyfTq8otWPfQjSpMLJM9HUARsE4QRdK1k8WT6gyqaxFfX9c/yCbcgZMEHQCcdInA ZoKw== 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=tdBXHutzuM0KAhW6gQbcRV3uofOs2zGK24vMcRPKSq4=; b=t/BYN82TJfFhGHmzpgWLRIWeR3mWYL4ZN6mkS84NpM3Pr337C8G/7mvoOqa2G344hg P+HLw/U1JTX4bdtxlc2+HLmv2jGeTg9qmrYiF0GxpojqR8mNUiQ/CDoNMwXBI/B7CoLV fsa4EFivyEl8dj9GHQGDPGt+S/+ZQmTJjgemtjb7eu5esp/FY/ZNdQWP5qMtr1ch3O27 WeTWDnWxxpL6rEkoZBPsVHZTfYluX26lUgetpNpUGUIl6ZgAYNkoo6KOWN+XB8Mhslx/ xeDWqsF84Srj/L2cMtYbv/7RUfGkNfYD80VGOQtBXj4avj0PeN7wnc6zmdVLb7nDqE/C 02Xg== X-Gm-Message-State: AODbwcDGzTvBjLBB20oR896wmPZYBet6c5Uox6FnCFF5M5gA81cb2DGn 9uiALRzNAOUFeA== X-Received: by 10.84.217.222 with SMTP id d30mr4882528plj.156.1494384674840; Tue, 09 May 2017 19:51:14 -0700 (PDT) Received: from localhost.localdomain ([2605:e000:6106:100:c9f2:48f0:2df:d658]) by smtp.gmail.com with ESMTPSA id t5sm2036379pgo.48.2017.05.09.19.51.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 May 2017 19:51:14 -0700 (PDT) From: Christian Stewart To: buildroot@buildroot.org Date: Tue, 9 May 2017 22:51:08 -0400 Message-Id: <20170510025108.21169-3-christian@paral.in> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170510025108.21169-1-christian@paral.in> References: <20170510025108.21169-1-christian@paral.in> Cc: thomas.petazzoni@free-electrons.com, geoff@infradead.org, Christian Stewart , fontaine.fabrice@gmail.com Subject: [Buildroot] [PATCH 3/3] 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 05670a7..7d9a87f 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 c4c1157..bdb2f31 100644 --- a/package/docker-engine/docker-engine.mk +++ b/package/docker-engine/docker-engine.mk @@ -45,6 +45,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) @@ -114,6 +121,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))