[bug#35281] gnu: docker: Add a couple go dependencies and enable docker-proxy.

Message ID 87muksnqaq.fsf@gmail.com
State Accepted
Headers show
Series [bug#35281] gnu: docker: Add a couple go dependencies and enable docker-proxy. | expand

Checks

Context Check Description
cbaines/applying patch fail Apply failed

Commit Message

Maxim Cournoyer April 14, 2019, 11:02 p.m. UTC
Hello Guix!

Before this change, attempting to start a docker registry such as with
the following command[0]:

--8<---------------cut here---------------start------------->8---
docker run -d -p 5000:5000 --restart=always --name registry registry:2
--8<---------------cut here---------------end--------------->8---

Would give the following error:

--8<---------------cut here---------------start------------->8---
/gnu/store/dzaijl53fcd3jhkpd70vsf4cnvv10ywj-docker-cli-18.09.3/bin/docker:
Error response from daemon: driver failed programming external
connectivity on endpoint registry
(709754084a9e208c32075e47ea9584296a6f274deeef08283d0de9c9a5161112):
exec: "docker-proxy": executable file not found in $PATH.
--8<---------------cut here---------------end--------------->8---

This series of patches adds docker-libnetwork-cmd-proxy and a few new go
packages it required.

The docker service is modified to enable (or disable) using a 'docker-proxy'.

Thanks!

Maxim

Comments

Danny Milosavljevic April 15, 2019, 6:22 a.m. UTC | #1
Hi,

On Sun, 14 Apr 2019 19:02:53 -0400
Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

> +         ;; The tests fail with the error:
> +         ;; src/github.com/docker/libnetwork/network.go:1057: Warnf format %q
> +         ;; has arg n.configOnly of wrong type bool.
> +         #:tests? #f))
> +      (home-page "https://github.com/docker/libnetwork/")

It might make sense to report that bug upstream--they're helpful people.

Otherwise LGTM!
Maxim Cournoyer April 15, 2019, 10:14 p.m. UTC | #2
Hi Danny!

Danny Milosavljevic <dannym@scratchpost.org> writes:

> Hi,
>
> On Sun, 14 Apr 2019 19:02:53 -0400
> Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>
>> +         ;; The tests fail with the error:
>> +         ;; src/github.com/docker/libnetwork/network.go:1057: Warnf format %q
>> +         ;; has arg n.configOnly of wrong type bool.
>> +         #:tests? #f))
>> +      (home-page "https://github.com/docker/libnetwork/")
>
> It might make sense to report that bug upstream--they're helpful people.
>
> Otherwise LGTM!

Thanks for bringing my attention to that part; I've tried re-enabling
the tests but it seems to fail because of unmet dependencies now --
which makes sense since I'm not adding any inputs.  I've removed the
tests? #f argument and detailed in the top comment that this is simply
used as a template and doesn't even build.

Thanks for the review!

Maxim
Maxim Cournoyer May 6, 2019, 12:26 a.m. UTC | #3
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Hi Danny!
>
> Danny Milosavljevic <dannym@scratchpost.org> writes:
>
>> Hi,
>>
>> On Sun, 14 Apr 2019 19:02:53 -0400
>> Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>>
>>> +         ;; The tests fail with the error:
>>> +         ;; src/github.com/docker/libnetwork/network.go:1057: Warnf format %q
>>> +         ;; has arg n.configOnly of wrong type bool.
>>> +         #:tests? #f))
>>> +      (home-page "https://github.com/docker/libnetwork/")
>>
>> It might make sense to report that bug upstream--they're helpful people.
>>
>> Otherwise LGTM!
>
> Thanks for bringing my attention to that part; I've tried re-enabling
> the tests but it seems to fail because of unmet dependencies now --
> which makes sense since I'm not adding any inputs.  I've removed the
> tests? #f argument and detailed in the top comment that this is simply
> used as a template and doesn't even build.
>
> Thanks for the review!
>
> Maxim

Pushed as 7a31d93a61. Thanks!

Maxim

Patch

From fd1003dc333ede95a8fa2813b7e8ab2f6cfe82d2 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 5 Apr 2019 02:34:16 -0400
Subject: [PATCH 6/6] services: docker: Add new fields to support proxy.

The Docker proxy enables inter-container and outside-to-container loopback,
and is required by the Docker registry server.

* gnu/services/docker.scm (docker-configuration)[proxy,
enable-proxy?]: Add fields.
(docker-shepherd-service): Use them.
(serialize-boolean): New function.
---
 gnu/services/docker.scm | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/gnu/services/docker.scm b/gnu/services/docker.scm
index 8b5edf5cb0..94a04c8996 100644
--- a/gnu/services/docker.scm
+++ b/gnu/services/docker.scm
@@ -31,13 +31,25 @@ 
   #:export (docker-configuration
             docker-service-type))
 
+;;; We're not using serialize-configuration, but we must define this because
+;;; the define-configuration macro validates it exists.
+(define (serialize-boolean field-name val)
+  "")
+
 (define-configuration docker-configuration
   (docker
    (package docker)
    "Docker daemon package.")
   (containerd
    (package containerd)
-   "containerd package."))
+   "containerd package.")
+  (proxy
+   (package docker-libnetwork-cmd-proxy)
+   "The proxy package to support inter-container and outside-container
+loop-back communications.")
+  (enable-proxy?
+   (boolean #t)
+   "Enable or disable the user-land proxy (enabled by default)."))
 
 (define %docker-accounts
   (list (user-group (name "docker") (system? #t))))
@@ -66,7 +78,9 @@ 
            (stop #~(make-kill-destructor)))))
 
 (define (docker-shepherd-service config)
-  (let* ((docker (docker-configuration-docker config)))
+  (let* ((docker (docker-configuration-docker config))
+         (enable-proxy? (docker-configuration-enable-proxy? config))
+         (proxy (docker-configuration-proxy config)))
     (shepherd-service
            (documentation "Docker daemon.")
            (provision '(dockerd))
@@ -83,7 +97,10 @@ 
                           udev))
            (start #~(make-forkexec-constructor
                      (list (string-append #$docker "/bin/dockerd")
-                           "-p" "/var/run/docker.pid")
+                           "-p" "/var/run/docker.pid"
+                           (if #$enable-proxy? "--userland-proxy" "")
+                           "--userland-proxy-path" (string-append #$proxy
+                                                                  "/bin/proxy"))
                      #:pid-file "/var/run/docker.pid"
                      #:log-file "/var/log/docker.log"))
            (stop #~(make-kill-destructor)))))
-- 
2.20.1