gnu: Remove ".git" from "https://github/…/….git".
[jackhill/guix/guix.git] / gnu / packages / docker.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
6 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
7 ;;; Copyright © 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages docker)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (gnu packages)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix build-system cmake)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system go)
33 #:use-module (guix build-system python)
34 #:use-module (guix utils)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages base)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages glib)
40 #:use-module (gnu packages golang)
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages networking)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages python)
45 #:use-module (gnu packages python-crypto)
46 #:use-module (gnu packages python-web)
47 #:use-module (gnu packages python-xyz)
48 #:use-module (gnu packages version-control)
49 #:use-module (gnu packages virtualization))
50
51 (define %docker-version "19.03.12")
52
53 (define-public python-docker-py
54 (package
55 (name "python-docker-py")
56 (version "3.7.3")
57 (source
58 (origin
59 (method url-fetch)
60 (uri (pypi-uri "docker" version))
61 (sha256
62 (base32
63 "0qmrcvpaz37p85hfddsd4yc8hgqlkzs4cz09q9wmy0pz5pwajqm0"))))
64 (build-system python-build-system)
65 ;; TODO: Tests require a running Docker daemon.
66 (arguments '(#:tests? #f))
67 (inputs
68 `(("python-requests" ,python-requests-2.20)
69 ("python-ipaddress" ,python-ipaddress)
70 ("python-six" ,python-six)
71 ("python-urllib3" ,python-urllib3-1.24)
72 ("python-websocket-client" ,python-websocket-client)))
73 (propagated-inputs
74 `(("python-docker-pycreds" ,python-docker-pycreds)
75 ("python-paramiko" ,python-paramiko))) ; adds SSH support
76 (home-page "https://github.com/docker/docker-py/")
77 (synopsis "Python client for Docker")
78 (description "Docker-Py is a Python client for the Docker container
79 management tool.")
80 (license license:asl2.0)))
81
82 (define-public python-dockerpty
83 (package
84 (name "python-dockerpty")
85 (version "0.4.1")
86 (source
87 (origin
88 (method url-fetch)
89 (uri (pypi-uri "dockerpty" version))
90 (sha256
91 (base32
92 "1kjn64wx23jmr8dcc6g7bwlmrhfmxr77gh6iphqsl39sayfxdab9"))))
93 (build-system python-build-system)
94 (native-inputs
95 `(("python-six" ,python-six)))
96 (home-page "https://github.com/d11wtq/dockerpty")
97 (synopsis "Python library to use the pseudo-TTY of a Docker container")
98 (description "Docker PTY provides the functionality needed to operate the
99 pseudo-terminal (PTY) allocated to a Docker container using the Python
100 client.")
101 (license license:asl2.0)))
102
103 (define-public docker-compose
104 (package
105 (name "docker-compose")
106 (version "1.25.4")
107 (source
108 (origin
109 (method url-fetch)
110 (uri (pypi-uri "docker-compose" version))
111 (sha256
112 (base32
113 "1ww8ckpj3n5jdg63qvmiqx3gk0fsrnynnnqj17fppymbwjzf5fps"))))
114 (build-system python-build-system)
115 ;; TODO: Tests require running Docker daemon.
116 (arguments '(#:tests? #f))
117 (inputs
118 `(("python-cached-property"
119 ,python-cached-property)
120 ("python-docker-py" ,python-docker-py)
121 ("python-dockerpty" ,python-dockerpty)
122 ("python-docopt" ,python-docopt)
123 ("python-jsonschema" ,python-jsonschema)
124 ("python-pyyaml" ,python-pyyaml)
125 ("python-requests" ,python-requests)
126 ("python-six" ,python-six)
127 ("python-texttable" ,python-texttable)
128 ("python-websocket-client" ,python-websocket-client)))
129 (home-page "https://www.docker.com/")
130 (synopsis "Multi-container orchestration for Docker")
131 (description "Docker Compose is a tool for defining and running
132 multi-container Docker applications. A Compose file is used to configure an
133 application’s services. Then, using a single command, the containers are
134 created and all the services are started as specified in the configuration.")
135 (license license:asl2.0)))
136
137 (define-public python-docker-pycreds
138 (package
139 (name "python-docker-pycreds")
140 (version "0.4.0")
141 (source
142 (origin
143 (method url-fetch)
144 (uri (pypi-uri "docker-pycreds" version))
145 (sha256
146 (base32
147 "1m44smrggnqghxkqfl7vhapdw89m1p3vdr177r6cq17lr85jgqvc"))))
148 (build-system python-build-system)
149 (arguments
150 `(#:phases
151 (modify-phases %standard-phases
152 (add-after 'unpack 'fix-versioning
153 (lambda _
154 (substitute* "test-requirements.txt"
155 (("3.0.2") ,(package-version python-pytest))
156 (("2.3.1") ,(package-version python-pytest-cov))
157 (("2.4.1") ,(package-version python-flake8)))
158 #t)))))
159 (native-inputs
160 `(("python-flake8" ,python-flake8)
161 ("python-pytest" ,python-pytest)
162 ("python-pytest-cov" ,python-pytest-cov)))
163 (propagated-inputs
164 `(("python-six" ,python-six)))
165 (home-page "https://github.com/shin-/dockerpy-creds")
166 (synopsis
167 "Python bindings for the Docker credentials store API")
168 (description
169 "Docker-Pycreds contains the Python bindings for the docker credentials
170 store API. It allows programmers to interact with a Docker registry using
171 Python without keeping their credentials in a Docker configuration file.")
172 (license license:asl2.0)))
173
174 (define-public containerd
175 (package
176 (name "containerd")
177 (version "1.2.5")
178 (source
179 (origin
180 (method git-fetch)
181 (uri (git-reference
182 (url "https://github.com/containerd/containerd")
183 (commit (string-append "v" version))))
184 (file-name (git-file-name name version))
185 (sha256
186 (base32 "0npbzixf3c0jvzm159vygvkydrr8h36c9sq50yv0mdinrys2bvg0"))
187 (patches
188 (search-patches "containerd-test-with-go1.13.patch"))))
189 (build-system go-build-system)
190 (arguments
191 `(#:import-path "github.com/containerd/containerd"
192 #:phases
193 (modify-phases %standard-phases
194 (add-before 'build 'chdir
195 (lambda _
196 (chdir "src/github.com/containerd/containerd")
197 #t))
198 (add-after 'chdir 'patch-paths
199 (lambda* (#:key inputs outputs #:allow-other-keys)
200 ;; TODO: Patch "socat", "unpigz".
201 (substitute* "./runtime/v1/linux/runtime.go"
202 (("defaultRuntime[ \t]*=.*")
203 (string-append "defaultRuntime = \""
204 (assoc-ref inputs "runc")
205 "/sbin/runc\"\n"))
206 (("defaultShim[ \t]*=.*")
207 (string-append "defaultShim = \""
208 (assoc-ref outputs "out")
209 "/bin/containerd-shim\"\n")))
210 (substitute* "./vendor/github.com/containerd/go-runc/runc.go"
211 (("DefaultCommand[ \t]*=.*")
212 (string-append "DefaultCommand = \""
213 (assoc-ref inputs "runc")
214 "/sbin/runc\"\n")))
215 (substitute* "vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go"
216 (("exec\\.Command\\(\"losetup\"") ; )
217 (string-append "exec.Command(\""
218 (assoc-ref inputs "util-linux")
219 "/sbin/losetup\""))) ;)
220 #t))
221 (replace 'build
222 (lambda* (#:key (make-flags '()) #:allow-other-keys)
223 (apply invoke "make" make-flags)))
224 (replace 'install
225 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
226 (let* ((out (assoc-ref outputs "out")))
227 (apply invoke "make" (string-append "DESTDIR=" out) "install"
228 make-flags)))))))
229 (inputs
230 `(("btrfs-progs" ,btrfs-progs)
231 ("libseccomp" ,libseccomp)
232 ("runc" ,runc)
233 ("util-linux" ,util-linux)))
234 (native-inputs
235 `(("go" ,go)
236 ("pkg-config" ,pkg-config)))
237 (synopsis "Docker container runtime")
238 (description "This package provides the container daemon for Docker.
239 It includes image transfer and storage, container execution and supervision,
240 network attachments.")
241 (home-page "https://containerd.io/")
242 (license license:asl2.0)))
243
244 ;;; Private package that shouldn't be used directly; its purposes is to be
245 ;;; used as a template for the various packages it contains. It doesn't build
246 ;;; anyway, as it needs many dependencies that aren't being satisfied.
247 (define docker-libnetwork
248 ;; There are no recent release for libnetwork, so choose the last commit of
249 ;; the branch that Docker uses, as can be seen in the Docker source file
250 ;; 'hack/dockerfile/install/proxy.installer'.
251 (let ((commit "4725f2163fb214a6312f3beae5991f838ec36326")
252 (version "18.09")
253 (revision "1"))
254 (package
255 (name "docker-libnetwork")
256 (version (git-version version "1" commit))
257 (source (origin
258 (method git-fetch)
259 (uri (git-reference
260 (url "https://github.com/docker/libnetwork")
261 (commit commit)))
262 (file-name (git-file-name name version))
263 (sha256
264 (base32
265 "1zpnxki8qfzha6ljahpwd3vkzmjhsvkmf73w6crm4ilxxw5vnpfb"))
266 ;; Delete bundled ("vendored") free software source code.
267 (modules '((guix build utils)))
268 (snippet '(begin
269 (delete-file-recursively "vendor")
270 #t))))
271 (build-system go-build-system)
272 (arguments
273 `(#:import-path "github.com/docker/libnetwork/"))
274 (home-page "https://github.com/docker/libnetwork/")
275 (synopsis "Networking for containers")
276 (description "Libnetwork provides a native Go implementation for
277 connecting containers. The goal of @code{libnetwork} is to deliver a robust
278 container network model that provides a consistent programming interface and
279 the required network abstractions for applications.")
280 (license license:asl2.0))))
281
282 (define-public docker-libnetwork-cmd-proxy
283 (package
284 (inherit docker-libnetwork)
285 (name "docker-libnetwork-cmd-proxy")
286 (arguments
287 `(#:import-path "github.com/docker/libnetwork/cmd/proxy"
288 #:unpack-path "github.com/docker/libnetwork"
289 #:install-source? #f))
290 (native-inputs
291 `(("go-sctp" ,go-sctp)
292 ;; For tests.
293 ("logrus" ,go-github-com-sirupsen-logrus)
294 ("go-netlink" ,go-netlink)
295 ("go-netns" ,go-netns)
296 ("go-golang-org-x-crypto"
297 ,go-golang-org-x-crypto)
298 ("go-golang-org-x-sys" ,go-golang-org-x-sys)))
299 (synopsis "Docker user-space proxy")
300 (description "A proxy running in the user space. It is used by the
301 built-in registry server of Docker.")
302 (license license:asl2.0)))
303
304 ;; TODO: Patch out modprobes for ip_vs, nf_conntrack,
305 ;; brige, nf_conntrack_netlink, aufs.
306 (define-public docker
307 (package
308 (name "docker")
309 (version %docker-version)
310 (source
311 (origin
312 (method git-fetch)
313 (uri (git-reference
314 (url "https://github.com/docker/engine")
315 (commit (string-append "v" version))))
316 (file-name (git-file-name name version))
317 (sha256
318 (base32 "1dj6llfcgcbpq9q9j6b4wb0anbn1g5wzm8ikq2lyhg54i3154m93"))
319 (patches
320 (search-patches "docker-fix-tests.patch"))))
321 (build-system gnu-build-system)
322 (arguments
323 `(#:modules
324 ((guix build gnu-build-system)
325 ((guix build go-build-system) #:prefix go:)
326 (guix build union)
327 (guix build utils))
328 #:imported-modules
329 (,@%gnu-build-system-modules
330 (guix build union)
331 (guix build go-build-system))
332 #:phases
333 (modify-phases %standard-phases
334 (add-after 'unpack 'patch-paths
335 (lambda* (#:key inputs #:allow-other-keys)
336 (substitute* "builder/builder-next/executor_unix.go"
337 (("CommandCandidates:.*runc.*")
338 (string-append "CommandCandidates: []string{\""
339 (assoc-ref inputs "runc")
340 "/sbin/runc\"},\n")))
341 (substitute* "vendor/github.com/containerd/go-runc/runc.go"
342 (("DefaultCommand = .*")
343 (string-append "DefaultCommand = \""
344 (assoc-ref inputs "runc")
345 "/sbin/runc\"\n")))
346 (substitute* "vendor/github.com/containerd/containerd/runtime/v1/linux/runtime.go"
347 (("defaultRuntime[ \t]*=.*")
348 (string-append "defaultRuntime = \""
349 (assoc-ref inputs "runc")
350 "/sbin/runc\"\n"))
351 (("defaultShim[ \t]*=.*")
352 (string-append "defaultShim = \""
353 (assoc-ref inputs "containerd")
354 "/bin/containerd-shim\"\n")))
355 (substitute* "daemon/daemon_unix.go"
356 (("DefaultShimBinary = .*")
357 (string-append "DefaultShimBinary = \""
358 (assoc-ref inputs "containerd")
359 "/bin/containerd-shim\"\n"))
360 (("DefaultRuntimeBinary = .*")
361 (string-append "DefaultRuntimeBinary = \""
362 (assoc-ref inputs "runc")
363 "/sbin/runc\"\n"))
364 (("DefaultRuntimeName = .*")
365 (string-append "DefaultRuntimeName = \""
366 (assoc-ref inputs "runc")
367 "/sbin/runc\"\n")))
368 (substitute* "daemon/config/config.go"
369 (("StockRuntimeName = .*")
370 (string-append "StockRuntimeName = \""
371 (assoc-ref inputs "runc")
372 "/sbin/runc\"\n"))
373 (("DefaultInitBinary = .*")
374 (string-append "DefaultInitBinary = \""
375 (assoc-ref inputs "tini")
376 "/bin/tini\"\n")))
377 (substitute* "daemon/config/config_common_unix_test.go"
378 (("expectedInitPath: \"docker-init\"")
379 (string-append "expectedInitPath: \""
380 (assoc-ref inputs "tini")
381 "/bin/tini\"")))
382 (substitute* "vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go"
383 (("var defaultCommandCandidates = .*")
384 (string-append "var defaultCommandCandidates = []string{\""
385 (assoc-ref inputs "runc") "/sbin/runc\"}")))
386 (substitute* "vendor/github.com/docker/libnetwork/portmapper/proxy.go"
387 (("var userlandProxyCommandName = .*")
388 (string-append "var userlandProxyCommandName = \""
389 (assoc-ref inputs "docker-proxy")
390 "/bin/proxy\"\n")))
391 (substitute* "pkg/archive/archive.go"
392 (("string\\{\"xz")
393 (string-append "string{\"" (assoc-ref inputs "xz") "/bin/xz")))
394 ;; TODO: Remove when Docker proper uses v1.14.x to build
395 (substitute* "registry/resumable/resumablerequestreader_test.go"
396 (("I%27m%20not%20an%20url" all)
397 (string-append "\"" all "\"")))
398 ;; TODO: Remove when Docker proper uses v1.14.x to build
399 (substitute* "vendor/gotest.tools/x/subtest/context.go"
400 (("func \\(tc \\*testcase\\) Cleanup\\(" all)
401 (string-append all "func()"))
402 (("tc\\.Cleanup\\(" all)
403 (string-append all "nil")))
404
405 (let ((source-files (filter (lambda (name)
406 (not (string-contains name "test")))
407 (find-files "." "\\.go$"))))
408 (let-syntax ((substitute-LookPath*
409 (syntax-rules ()
410 ((_ (source-text package relative-path) ...)
411 (substitute* source-files
412 (((string-append "\\<exec\\.LookPath\\(\""
413 source-text
414 "\")"))
415 (string-append "\""
416 (assoc-ref inputs package)
417 "/" relative-path
418 "\", error(nil)")) ...))))
419 (substitute-Command*
420 (syntax-rules ()
421 ((_ (source-text package relative-path) ...)
422 (substitute* source-files
423 (((string-append "\\<(re)?exec\\.Command\\(\""
424 source-text
425 "\"") _ re?)
426 (string-append (if re? re? "")
427 "exec.Command(\""
428 (assoc-ref inputs package)
429 "/" relative-path
430 "\"")) ...)))))
431 (substitute-LookPath*
432 ("containerd" "containerd" "bin/containerd")
433 ("ps" "procps" "bin/ps")
434 ("mkfs.xfs" "xfsprogs" "bin/mkfs.xfs")
435 ("lvmdiskscan" "lvm2" "sbin/lvmdiskscan")
436 ("pvdisplay" "lvm2" "sbin/pvdisplay")
437 ("blkid" "util-linux" "sbin/blkid")
438 ("unpigz" "pigz" "bin/unpigz")
439 ("iptables" "iptables" "sbin/iptables")
440 ("iptables-legacy" "iptables" "sbin/iptables")
441 ("ip" "iproute2" "sbin/ip"))
442
443 (substitute-Command*
444 ("modprobe" "kmod" "bin/modprobe")
445 ("pvcreate" "lvm2" "sbin/pvcreate")
446 ("vgcreate" "lvm2" "sbin/vgcreate")
447 ("lvcreate" "lvm2" "sbin/lvcreate")
448 ("lvconvert" "lvm2" "sbin/lvconvert")
449 ("lvchange" "lvm2" "sbin/lvchange")
450 ("mkfs.xfs" "xfsprogs" "sbin/mkfs.xfs")
451 ("xfs_growfs" "xfsprogs" "sbin/xfs_growfs")
452 ("mkfs.ext4" "e2fsprogs" "sbin/mkfs.ext4")
453 ("tune2fs" "e2fsprogs" "sbin/tune2fs")
454 ("blkid" "util-linux" "sbin/blkid")
455 ("resize2fs" "e2fsprogs" "sbin/resize2fs")
456 ("ps" "procps" "bin/ps")
457 ("losetup" "util-linux" "sbin/losetup")
458 ("uname" "coreutils" "bin/uname")
459 ("dbus-launch" "dbus" "bin/dbus-launch")
460 ("git" "git" "bin/git")))
461 ;; docker-mountfrom ??
462 ;; docker
463 ;; docker-untar ??
464 ;; docker-applyLayer ??
465 ;; /usr/bin/uname
466 ;; grep
467 ;; apparmor_parser
468
469 ;; Make compilation fail when, in future versions, Docker
470 ;; invokes other programs we don't know about and thus don't
471 ;; substitute.
472 (substitute* source-files
473 ;; Search for Java in PATH.
474 (("\\<exec\\.Command\\(\"java\"")
475 "xxec.Command(\"java\"")
476 ;; Search for AUFS in PATH (mainline Linux doesn't support it).
477 (("\\<exec\\.Command\\(\"auplink\"")
478 "xxec.Command(\"auplink\"")
479 ;; Fail on other unsubstituted commands.
480 (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\""
481 _ executable)
482 (string-append "exec.Guix_doesnt_want_Command(\""
483 executable "\""))
484 (("\\<xxec\\.Command")
485 "exec.Command")
486 ;; Search for ZFS in PATH.
487 (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")")
488 ;; Fail on other unsubstituted LookPaths.
489 (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"")
490 (("\\<LooxPath") "LookPath")))
491 #t))
492 (add-after 'patch-paths 'delete-failing-tests
493 (lambda _
494 ;; Needs internet access.
495 (delete-file "builder/remotecontext/git/gitutils_test.go")
496 ;; Permission denied.
497 (delete-file "daemon/graphdriver/devmapper/devmapper_test.go")
498 ;; Operation not permitted (idtools.MkdirAllAndChown).
499 (delete-file "daemon/graphdriver/vfs/vfs_test.go")
500 ;; Timeouts after 5 min.
501 (delete-file "plugin/manager_linux_test.go")
502 ;; Operation not permitted.
503 (delete-file "daemon/graphdriver/aufs/aufs_test.go")
504 (delete-file "daemon/graphdriver/btrfs/btrfs_test.go")
505 (delete-file "daemon/graphdriver/overlay/overlay_test.go")
506 (delete-file "daemon/graphdriver/overlay2/overlay_test.go")
507 (delete-file "pkg/chrootarchive/archive_unix_test.go")
508 (delete-file "daemon/container_unix_test.go")
509 ;; This file uses cgroups and /proc.
510 (delete-file "pkg/sysinfo/sysinfo_linux_test.go")
511 ;; This file uses cgroups.
512 (delete-file "runconfig/config_test.go")
513 ;; This file uses /var.
514 (delete-file "daemon/oci_linux_test.go")
515 #t))
516 (replace 'configure
517 (lambda _
518 (setenv "DOCKER_GITCOMMIT" (string-append "v" ,%docker-version))
519 (setenv "VERSION" (string-append ,%docker-version "-ce"))
520 ;; Automatically use bundled dependencies.
521 ;; TODO: Unbundle - see file "vendor.conf".
522 (setenv "AUTO_GOPATH" "1")
523 ;; Respectively, strip the symbol table and debug
524 ;; information, and the DWARF symbol table.
525 (setenv "LDFLAGS" "-s -w")
526 ;; Make build faster
527 (setenv "GOCACHE" "/tmp")
528 #t))
529 (add-before 'build 'setup-go-environment
530 (assoc-ref go:%standard-phases 'setup-go-environment))
531 (replace 'build
532 (lambda _
533 ;; Our LD doesn't like the statically linked relocatable things
534 ;; that go produces, so install the dynamic version of
535 ;; dockerd instead.
536 (invoke "hack/make.sh" "dynbinary")))
537 (replace 'check
538 (lambda _
539 ;; The build process generated a file because the environment
540 ;; variable "AUTO_GOPATH" was set. Use it.
541 (setenv "GOPATH" (string-append (getcwd) "/.gopath"))
542 ;; ".gopath/src/github.com/docker/docker" is a link to the current
543 ;; directory and chdir would canonicalize to that.
544 ;; But go needs to have the uncanonicalized directory name, so
545 ;; store that.
546 (setenv "PWD" (string-append (getcwd)
547 "/.gopath/src/github.com/docker/docker"))
548 (with-directory-excursion ".gopath/src/github.com/docker/docker"
549 (invoke "hack/test/unit"))
550 (setenv "PWD" #f)
551 #t))
552 (replace 'install
553 (lambda* (#:key outputs #:allow-other-keys)
554 (let* ((out (assoc-ref outputs "out"))
555 (out-bin (string-append out "/bin")))
556 (install-file "bundles/dynbinary-daemon/dockerd" out-bin)
557 (install-file (string-append "bundles/dynbinary-daemon/dockerd-"
558 (getenv "VERSION"))
559 out-bin)
560 #t)))
561 (add-after 'install 'remove-go-references
562 (assoc-ref go:%standard-phases 'remove-go-references)))))
563 (inputs
564 `(("btrfs-progs" ,btrfs-progs)
565 ("containerd" ,containerd) ; for containerd-shim
566 ("coreutils" ,coreutils)
567 ("dbus" ,dbus)
568 ("docker-proxy" ,docker-libnetwork-cmd-proxy)
569 ("e2fsprogs" ,e2fsprogs)
570 ("git" ,git)
571 ("iproute2" ,iproute)
572 ("iptables" ,iptables)
573 ("kmod" ,kmod)
574 ("libseccomp" ,libseccomp)
575 ("pigz" ,pigz)
576 ("procps" ,procps)
577 ("runc" ,runc)
578 ("util-linux" ,util-linux)
579 ("lvm2" ,lvm2)
580 ("tini" ,tini)
581 ("xfsprogs" ,xfsprogs)
582 ("xz" ,xz)))
583 (native-inputs
584 `(("eudev" ,eudev) ; TODO: Should be propagated by lvm2 (.pc -> .pc)
585 ("go" ,go)
586 ("gotestsum" ,gotestsum)
587 ("pkg-config" ,pkg-config)))
588 (synopsis "Docker container component library, and daemon")
589 (description "This package provides a framework to assemble specialized
590 container systems. It includes components for orchestration, image
591 management, secret management, configuration management, networking,
592 provisioning etc.")
593 (home-page "https://mobyproject.org/")
594 (license license:asl2.0)))
595
596 (define-public docker-cli
597 (package
598 (name "docker-cli")
599 (version %docker-version)
600 (source
601 (origin
602 (method git-fetch)
603 (uri (git-reference
604 (url "https://github.com/docker/cli")
605 (commit (string-append "v" version))))
606 (file-name (git-file-name name version))
607 (sha256
608 (base32 "1bynmnaykhh1m42v6bxparlpm9kajpqsvlrlwgz1b9ivcklf5ik6"))))
609 (build-system go-build-system)
610 (arguments
611 `(#:import-path "github.com/docker/cli"
612 ;; TODO: Tests require a running Docker daemon.
613 #:tests? #f
614 #:phases
615 (modify-phases %standard-phases
616 (add-before 'build 'setup-environment-2
617 (lambda _
618 ;; Respectively, strip the symbol table and debug
619 ;; information, and the DWARF symbol table.
620 (setenv "LDFLAGS" "-s -w")
621
622 ;; Make sure "docker -v" prints a usable version string.
623 (setenv "VERSION" ,%docker-version)
624
625 ;; Make build reproducible.
626 (setenv "BUILDTIME" "1970-01-01 00:00:01.000000000+00:00")
627 (symlink "src/github.com/docker/cli/scripts" "./scripts")
628 (symlink "src/github.com/docker/cli/docker.Makefile" "./docker.Makefile")
629 #t))
630 (replace 'build
631 (lambda _
632 (invoke "./scripts/build/dynbinary")))
633 (replace 'check
634 (lambda* (#:key make-flags tests? #:allow-other-keys)
635 (setenv "PATH" (string-append (getcwd) "/build:" (getenv "PATH")))
636 (if tests?
637 ;; Use the newly-built docker client for the tests.
638 (with-directory-excursion "src/github.com/docker/cli"
639 ;; TODO: Run test-e2e as well?
640 (apply invoke "make" "-f" "docker.Makefile" "test-unit"
641 (or make-flags '())))
642 #t)))
643 (replace 'install
644 (lambda* (#:key outputs #:allow-other-keys)
645 (let* ((out (assoc-ref outputs "out"))
646 (out-bin (string-append out "/bin"))
647 (etc (string-append out "/etc")))
648 (with-directory-excursion "src/github.com/docker/cli/contrib/completion"
649 (install-file "bash/docker"
650 (string-append etc "/bash_completion.d"))
651 (install-file "fish/docker.fish"
652 (string-append etc "/fish/completions"))
653 (install-file "zsh/_docker"
654 (string-append etc "/zsh/site-functions")))
655 (chdir "build")
656 (install-file "docker" out-bin)
657 #t))))))
658 (native-inputs
659 `(("go" ,go)
660 ("libltdl" ,libltdl)
661 ("pkg-config" ,pkg-config)))
662 (synopsis "Command line interface to Docker")
663 (description "This package provides a command line interface to Docker.")
664 (home-page "https://www.docker.com/")
665 (license license:asl2.0)))
666
667 (define-public cqfd
668 (package
669 (name "cqfd")
670 (version "5.1.0")
671 (source (origin
672 (method git-fetch)
673 (uri (git-reference
674 (url "https://github.com/savoirfairelinux/cqfd")
675 (commit (string-append "v" version))))
676 (file-name (git-file-name name version))
677 (sha256
678 (base32
679 "1xhydz01f2rrnw7rmnaxh3f3q1ariq7j2ig0i0w1p3wn10l3q0nv"))))
680 (build-system gnu-build-system)
681 (arguments
682 ;; The test suite requires a docker daemon and connectivity.
683 `(#:tests? #f
684 #:phases
685 (modify-phases %standard-phases
686 (delete 'configure)
687 (delete 'build)
688 (replace 'install
689 (lambda* (#:key outputs #:allow-other-keys)
690 (let ((out (assoc-ref outputs "out")))
691 ;; Fix the directory of the bash completion.
692 (substitute* "Makefile"
693 (("completionsdir=.*$")
694 (string-append "completionsdir=" out
695 "/etc/bash_completion.d; \\\n")))
696 (invoke "make" "install"
697 (string-append "PREFIX=" out))))))))
698 (home-page "https://github.com/savoirfairelinux/cqfd")
699 (synopsis "Convenience wrapper for Docker")
700 (description "cqfd is a Bash script that provides a quick and convenient
701 way to run commands in the current directory, but within a Docker container
702 defined in a per-project configuration file.")
703 (license license:gpl3+)))
704
705 (define-public tini
706 (package
707 (name "tini")
708 (version "0.18.0")
709 (source (origin
710 (method git-fetch)
711 (uri (git-reference
712 (url "https://github.com/krallin/tini")
713 (commit (string-append "v" version))))
714 (file-name (git-file-name name version))
715 (sha256
716 (base32
717 "1h20i3wwlbd8x4jr2gz68hgklh0lb0jj7y5xk1wvr8y58fip1rdn"))))
718 (build-system cmake-build-system)
719 (arguments
720 `(#:tests? #f ;tests require a Docker daemon
721 #:phases (modify-phases %standard-phases
722 (add-after 'unpack 'disable-static-build
723 ;; Disable the static build as it fails to install, with
724 ;; the error: "No valid ELF RPATH or RUNPATH entry exists
725 ;; in the file".
726 (lambda _
727 (substitute* "CMakeLists.txt"
728 ((".*tini-static.*") ""))
729 #t)))))
730 (home-page "https://github.com/krallin/tini")
731 (synopsis "Tiny but valid init for containers")
732 (description "Tini is an init program specifically designed for use with
733 containers. It manages a single child process and ensures that any zombie
734 processes produced from it are reaped and that signals are properly forwarded.
735 Tini is integrated with Docker.")
736 (license license:expat)))