From patchwork Fri Dec 29 04:47:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Connor Clark X-Patchwork-Id: 58147 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A288E27BBE9; Fri, 29 Dec 2023 05:00:29 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 99F7127BBE2 for ; Fri, 29 Dec 2023 05:00:23 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rJ4yi-0001rC-OJ; Fri, 29 Dec 2023 00:00:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rJ4yf-0001r3-Ui for guix-patches@gnu.org; Fri, 29 Dec 2023 00:00:10 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rJ4ya-0004v9-2W for guix-patches@gnu.org; Fri, 29 Dec 2023 00:00:08 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rJ4yZ-0001iE-G0 for guix-patches@gnu.org; Fri, 29 Dec 2023 00:00:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68073] [PATCH v2] services: docker: Add config-file option. References: <20231227203015.14265-1-connor@psyleft.com> In-Reply-To: <20231227203015.14265-1-connor@psyleft.com> Resent-From: Connor Clark Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 29 Dec 2023 05:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68073 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68073@debbugs.gnu.org Cc: Connor Clark Received: via spool by 68073-submit@debbugs.gnu.org id=B68073.17038259996510 (code B ref 68073); Fri, 29 Dec 2023 05:00:03 +0000 Received: (at 68073) by debbugs.gnu.org; 29 Dec 2023 04:59:59 +0000 Received: from localhost ([127.0.0.1]:40601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJ4yV-0001gu-8Y for submit@debbugs.gnu.org; Thu, 28 Dec 2023 23:59:59 -0500 Received: from mout-p-202.mailbox.org ([2001:67c:2050:0:465::202]:51938) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJ4yS-0001gZ-Ka for 68073@debbugs.gnu.org; Thu, 28 Dec 2023 23:59:58 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4T1Y8M4bJpz9sb4; Fri, 29 Dec 2023 05:59:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=psyleft.com; s=MBO0001; t=1703825987; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=RSd38CJOiMEQVtgKu6EEa2xc2NEELuh94eXwsi5Y670=; b=PMkEj0zMzfJxZ1HfZYwh82ckWQ27xkqX/95wB3vW5Bel8ATvrgKqMDoGITUdTYuhLREKbe VTHNhkzitO158vfb5RyCwZaUDpn/cYdcHu2VYg2/hhzZ4paCHvpEYMAbSHS9UzHqQe/cno vkXRUDowWQya3N/H4yAhsMbVtIBbePK6lZpGgRZcxJYq9mNShPoEjdyeRqb4m0+HpLn583 YLvwsrtJWGcTw9oVsltIGav1NF1ffiDhthbx5naUG7HTYHdSLlaS/SkGiYRM+eh8t8Wu4a 7oP4p1hE37974CsDZD5FsLJv3TTza/mNfhOfTLVk7t/a51NajpvQL7mzlrUsjA== Date: Thu, 28 Dec 2023 23:47:37 -0500 Message-ID: <20231229045931.22051-1-connor@psyleft.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4T1Y8M4bJpz9sb4 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Connor Clark X-ACL-Warn: , Connor Clark via Guix-patches X-Patchwork-Original-From: Connor Clark via Guix-patches via From: Connor Clark Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/docker.scm (docker-configuration)[config-file] Add file-like field. * doc/guix.texi (Docker Service): Add information about config-file. --- Thanks for responding! This revision should fix the issues you raised. I added documentation in guix.texi and revised the commit message to fit in with the others. The tests file was a bit complex though, I couldn't figure out where I would extend it if I wanted to :). doc/guix.texi | 3 +++ gnu/services/docker.scm | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) base-commit: 5bd80ccd69047b1777749e24d4adf2c951b5d14b diff --git a/doc/guix.texi b/doc/guix.texi index a9a9272c35..a9488ff4b5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -39701,6 +39701,9 @@ This must be a list of strings where each string has the form "TMPDIR=/tmp/dockerd") @end lisp +@item @code{config-file} (type: maybe-file-like) +JSON configuration file pass to @command{dockerd}. + @end table @end deftp diff --git a/gnu/services/docker.scm b/gnu/services/docker.scm index 72ef7d74db..4d32b96847 100644 --- a/gnu/services/docker.scm +++ b/gnu/services/docker.scm @@ -61,6 +61,8 @@ (define-module (gnu services docker) oci-container-service-type oci-container-shepherd-service)) +(define-maybe file-like) + (define-configuration docker-configuration (docker (file-like docker) @@ -87,6 +89,9 @@ (define-configuration docker-configuration (environment-variables (list '()) "Environment variables to set for dockerd") + (config-file + (maybe-file-like) + "JSON configuration file to pass to dockerd") (no-serialization)) (define %docker-accounts @@ -131,7 +136,8 @@ (define (docker-shepherd-service config) (enable-iptables? (docker-configuration-enable-iptables? config)) (environment-variables (docker-configuration-environment-variables config)) (proxy (docker-configuration-proxy config)) - (debug? (docker-configuration-debug? config))) + (debug? (docker-configuration-debug? config)) + (config-file (docker-configuration-config-file config))) (shepherd-service (documentation "Docker daemon.") (provision '(dockerd)) @@ -144,6 +150,10 @@ (define (docker-shepherd-service config) (start #~(make-forkexec-constructor (list (string-append #$docker "/bin/dockerd") "-p" "/var/run/docker.pid" + #$@(if (not (eq? config-file %unset-value)) + (list #~(string-append + "--config-file=" #$config-file)) + '()) #$@(if debug? '("--debug" "--log-level=debug") '())