gnu: cqfd: Update to 5.3.0.
[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, 2020, 2021 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 ;;; Copyright © 2020 Jesse Dowell <jessedowell@gmail.com>
9 ;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages docker)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (gnu packages)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix build-system cmake)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system go)
35 #:use-module (guix build-system python)
36 #:use-module (guix utils)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages base)
39 #:use-module (gnu packages check)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages glib)
42 #:use-module (gnu packages golang)
43 #:use-module (gnu packages linux)
44 #:use-module (gnu packages networking)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages python-crypto)
48 #:use-module (gnu packages python-web)
49 #:use-module (gnu packages python-xyz)
50 #:use-module (gnu packages version-control)
51 #:use-module (gnu packages virtualization))
52
53 ;; Note - when changing Docker versions it is important to update the versions
54 ;; of several associated packages (docker-libnetwork and go-sctp).
55 (define %docker-version "19.03.15")
56
57 (define-public python-docker
58 (package
59 (name "python-docker")
60 (version "5.0.3")
61 (source
62 (origin
63 (method url-fetch)
64 (uri (pypi-uri "docker" version))
65 (sha256
66 (base32
67 "1yr7w8vmdis01myx26pqx7wcyz2cy1mfs421alppq3lpc9ms45nr"))))
68 (build-system python-build-system)
69 ;; TODO: Tests require a running Docker daemon.
70 (arguments '(#:tests? #f))
71 (inputs
72 (list python-requests python-six python-urllib3))
73 (propagated-inputs
74 (list python-docker-pycreds python-paramiko ;adds SSH support
75 python-websocket-client))
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 (list 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.29.2")
107 (source
108 (origin
109 (method url-fetch)
110 (uri (pypi-uri "docker-compose" version))
111 (sha256
112 (base32
113 "1dq9kfak61xx7chjrzmkvbw9mvj9008k7g8q7mwi4x133p9dk32c"))))
114 (build-system python-build-system)
115 ;; TODO: Tests require running Docker daemon.
116 (arguments '(#:tests? #f))
117 (inputs
118 (list python-cached-property
119 python-distro
120 python-docker
121 python-dockerpty
122 python-docopt
123 python-dotenv
124 python-jsonschema
125 python-pyyaml
126 python-requests
127 python-six
128 python-texttable
129 python-websocket-client))
130 (home-page "https://www.docker.com/")
131 (synopsis "Multi-container orchestration for Docker")
132 (description "Docker Compose is a tool for defining and running
133 multi-container Docker applications. A Compose file is used to configure an
134 application’s services. Then, using a single command, the containers are
135 created and all the services are started as specified in the configuration.")
136 (license license:asl2.0)))
137
138 (define-public python-docker-pycreds
139 (package
140 (name "python-docker-pycreds")
141 (version "0.4.0")
142 (source
143 (origin
144 (method url-fetch)
145 (uri (pypi-uri "docker-pycreds" version))
146 (sha256
147 (base32
148 "1m44smrggnqghxkqfl7vhapdw89m1p3vdr177r6cq17lr85jgqvc"))))
149 (build-system python-build-system)
150 (arguments
151 `(#:phases
152 (modify-phases %standard-phases
153 (add-after 'unpack 'fix-versioning
154 (lambda _
155 (substitute* "test-requirements.txt"
156 (("3.0.2") ,(package-version python-pytest))
157 (("2.3.1") ,(package-version python-pytest-cov))
158 (("2.4.1") ,(package-version python-flake8)))
159 #t)))))
160 (native-inputs
161 (list python-flake8 python-pytest python-pytest-cov))
162 (propagated-inputs
163 (list python-six))
164 (home-page "https://github.com/shin-/dockerpy-creds")
165 (synopsis
166 "Python bindings for the Docker credentials store API")
167 (description
168 "Docker-Pycreds contains the Python bindings for the docker credentials
169 store API. It allows programmers to interact with a Docker registry using
170 Python without keeping their credentials in a Docker configuration file.")
171 (license license:asl2.0)))
172
173 (define-public containerd
174 (package
175 (name "containerd")
176 (version "1.4.4")
177 (source
178 (origin
179 (method git-fetch)
180 (uri (git-reference
181 (url "https://github.com/containerd/containerd")
182 (commit (string-append "v" version))))
183 (file-name (git-file-name name version))
184 (sha256
185 (base32 "0qjbfj1dw6pykxhh8zahcxlgpyjzgnrngk5vjaf34akwyan8nrxb"))))
186 (build-system go-build-system)
187 (arguments
188 (let ((make-flags (list (string-append "VERSION=" version)
189 "REVISION=0")))
190 `(#:import-path "github.com/containerd/containerd"
191 #:phases
192 (modify-phases %standard-phases
193 (add-after 'chdir 'patch-paths
194 (lambda* (#:key inputs import-path outputs #:allow-other-keys)
195 (with-directory-excursion (string-append "src/" import-path)
196 (substitute* "runtime/v1/linux/runtime.go"
197 (("defaultRuntime[ \t]*=.*")
198 (string-append "defaultRuntime = \""
199 (assoc-ref inputs "runc")
200 "/sbin/runc\"\n"))
201 (("defaultShim[ \t]*=.*")
202 (string-append "defaultShim = \""
203 (assoc-ref outputs "out")
204 "/bin/containerd-shim\"\n")))
205 (substitute* "vendor/github.com/containerd/go-runc/runc.go"
206 (("DefaultCommand[ \t]*=.*")
207 (string-append "DefaultCommand = \""
208 (assoc-ref inputs "runc")
209 "/sbin/runc\"\n")))
210 (substitute* "vendor/github.com/containerd/continuity/testutil\
211 /loopback/loopback_linux.go"
212 (("exec\\.Command\\(\"losetup\"")
213 (string-append "exec.Command(\""
214 (assoc-ref inputs "util-linux")
215 "/sbin/losetup\"")))
216 (substitute* "archive/compression/compression.go"
217 (("exec\\.LookPath\\(\"unpigz\"\\)")
218 (string-append "\"" (assoc-ref inputs "pigz")
219 "/bin/unpigz\", error(nil)"))))))
220 (replace 'build
221 (lambda* (#:key import-path #:allow-other-keys)
222 (with-directory-excursion (string-append "src/" import-path)
223 (apply invoke "make" ',make-flags))))
224 (replace 'install
225 (lambda* (#:key import-path outputs #:allow-other-keys)
226 (with-directory-excursion (string-append "src/" import-path)
227 (let* ((out (assoc-ref outputs "out")))
228 (apply invoke "make" (string-append "DESTDIR=" out) "install"
229 ',make-flags)))))))))
230 (inputs
231 (list btrfs-progs libseccomp pigz runc util-linux))
232 (native-inputs
233 (list go pkg-config))
234 (synopsis "Docker container runtime")
235 (description "This package provides the container daemon for Docker.
236 It includes image transfer and storage, container execution and supervision,
237 network attachments.")
238 (home-page "https://containerd.io/")
239 (license license:asl2.0)))
240
241 ;;; Private package that shouldn't be used directly; its purposes is to be
242 ;;; used as a template for the various packages it contains. It doesn't build
243 ;;; anyway, as it needs many dependencies that aren't being satisfied.
244 (define docker-libnetwork
245 ;; There are no recent release for libnetwork, so choose the last commit of
246 ;; the branch that Docker uses, as can be seen in the Docker source file
247 ;; 'hack/dockerfile/install/proxy.installer'. NOTE - It is important that
248 ;; this version is kept in sync with the version of Docker being used.
249 ;; This commit is the "bump_19.03" branch, as mentioned in Docker's vendor.conf.
250 (let ((commit "55e924b8a84231a065879156c0de95aefc5f5435")
251 (version (version-major+minor %docker-version))
252 (revision "1"))
253 (package
254 (name "docker-libnetwork")
255 (version (git-version version revision commit))
256 (source (origin
257 (method git-fetch)
258 (uri (git-reference
259 ;; Redirected from github.com/docker/libnetwork.
260 (url "https://github.com/moby/libnetwork")
261 (commit commit)))
262 (file-name (git-file-name name version))
263 (sha256
264 (base32
265 "19syb3scwiykn44gqfaqrgqv8a0df4ps0ykf3za9xkjc5cyi99mp"))
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/moby/libnetwork/"))
274 (home-page "https://github.com/moby/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/moby/moby")
315 (commit (string-append "v" version))))
316 (file-name (git-file-name name version))
317 (sha256
318 (base32 "0419iha9zmwlhzhnbfxlsa13vgd04yifnsr8qqnj2ks5dxrcajl8"))
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-static\"\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-static\"")))
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 ;; Signal tests fail in bizarre ways
516 (delete-file "pkg/signal/signal_linux_test.go")
517 #t))
518 (replace 'configure
519 (lambda _
520 (setenv "DOCKER_BUILDTAGS" "seccomp")
521 (setenv "DOCKER_GITCOMMIT" (string-append "v" ,%docker-version))
522 (setenv "VERSION" (string-append ,%docker-version "-ce"))
523 ;; Automatically use bundled dependencies.
524 ;; TODO: Unbundle - see file "vendor.conf".
525 (setenv "AUTO_GOPATH" "1")
526 ;; Respectively, strip the symbol table and debug
527 ;; information, and the DWARF symbol table.
528 (setenv "LDFLAGS" "-s -w")
529 ;; Make build faster
530 (setenv "GOCACHE" "/tmp")
531 #t))
532 (add-before 'build 'setup-go-environment
533 (assoc-ref go:%standard-phases 'setup-go-environment))
534 (replace 'build
535 (lambda _
536 ;; Our LD doesn't like the statically linked relocatable things
537 ;; that go produces, so install the dynamic version of
538 ;; dockerd instead.
539 (invoke "hack/make.sh" "dynbinary")))
540 (replace 'check
541 (lambda _
542 ;; The build process generated a file because the environment
543 ;; variable "AUTO_GOPATH" was set. Use it.
544 (setenv "GOPATH" (string-append (getcwd) "/.gopath"))
545 ;; ".gopath/src/github.com/docker/docker" is a link to the current
546 ;; directory and chdir would canonicalize to that.
547 ;; But go needs to have the uncanonicalized directory name, so
548 ;; store that.
549 (setenv "PWD" (string-append (getcwd)
550 "/.gopath/src/github.com/docker/docker"))
551 (with-directory-excursion ".gopath/src/github.com/docker/docker"
552 (invoke "hack/test/unit"))
553 (setenv "PWD" #f)
554 #t))
555 (replace 'install
556 (lambda* (#:key outputs #:allow-other-keys)
557 (let* ((out (assoc-ref outputs "out"))
558 (out-bin (string-append out "/bin")))
559 (install-file "bundles/dynbinary-daemon/dockerd" out-bin)
560 (install-file (string-append "bundles/dynbinary-daemon/dockerd-"
561 (getenv "VERSION"))
562 out-bin)
563 #t)))
564 (add-after 'install 'remove-go-references
565 (assoc-ref go:%standard-phases 'remove-go-references)))))
566 (inputs
567 `(("btrfs-progs" ,btrfs-progs)
568 ("containerd" ,containerd) ; for containerd-shim
569 ("coreutils" ,coreutils)
570 ("dbus" ,dbus)
571 ("docker-proxy" ,docker-libnetwork-cmd-proxy)
572 ("e2fsprogs" ,e2fsprogs)
573 ("git" ,git)
574 ("iproute2" ,iproute)
575 ("iptables" ,iptables)
576 ("kmod" ,kmod)
577 ("libseccomp" ,libseccomp)
578 ("pigz" ,pigz)
579 ("procps" ,procps)
580 ("runc" ,runc)
581 ("util-linux" ,util-linux)
582 ("lvm2" ,lvm2)
583 ("tini" ,tini)
584 ("xfsprogs" ,xfsprogs)
585 ("xz" ,xz)))
586 (native-inputs
587 (list eudev ; TODO: Should be propagated by lvm2 (.pc -> .pc)
588 go-1.14 gotestsum pkg-config))
589 (synopsis "Docker container component library, and daemon")
590 (description "This package provides a framework to assemble specialized
591 container systems. It includes components for orchestration, image
592 management, secret management, configuration management, networking,
593 provisioning etc.")
594 (home-page "https://mobyproject.org/")
595 (license license:asl2.0)))
596
597 (define-public docker-cli
598 (package
599 (name "docker-cli")
600 (version %docker-version)
601 (source
602 (origin
603 (method git-fetch)
604 (uri (git-reference
605 (url "https://github.com/docker/cli")
606 (commit (string-append "v" version))))
607 (file-name (git-file-name name version))
608 (sha256
609 (base32 "1asapjj8brvbkd5irgdq82fx1ihrc14qaq30jxvjwflfm5yb7lv0"))))
610 (build-system go-build-system)
611 (arguments
612 `(#:import-path "github.com/docker/cli"
613 ;; TODO: Tests require a running Docker daemon.
614 #:tests? #f
615 #:phases
616 (modify-phases %standard-phases
617 (add-before 'build 'setup-environment-2
618 (lambda _
619 ;; Respectively, strip the symbol table and debug
620 ;; information, and the DWARF symbol table.
621 (setenv "LDFLAGS" "-s -w")
622
623 ;; Make sure "docker -v" prints a usable version string.
624 (setenv "VERSION" ,%docker-version)
625
626 ;; Make build reproducible.
627 (setenv "BUILDTIME" "1970-01-01 00:00:01.000000000+00:00")
628 (symlink "src/github.com/docker/cli/scripts" "./scripts")
629 (symlink "src/github.com/docker/cli/docker.Makefile" "./docker.Makefile")
630 #t))
631 (replace 'build
632 (lambda _
633 (invoke "./scripts/build/dynbinary")))
634 (replace 'check
635 (lambda* (#:key make-flags tests? #:allow-other-keys)
636 (setenv "PATH" (string-append (getcwd) "/build:" (getenv "PATH")))
637 (if tests?
638 ;; Use the newly-built docker client for the tests.
639 (with-directory-excursion "src/github.com/docker/cli"
640 ;; TODO: Run test-e2e as well?
641 (apply invoke "make" "-f" "docker.Makefile" "test-unit"
642 (or make-flags '())))
643 #t)))
644 (replace 'install
645 (lambda* (#:key outputs #:allow-other-keys)
646 (let* ((out (assoc-ref outputs "out"))
647 (out-bin (string-append out "/bin"))
648 (etc (string-append out "/etc")))
649 (with-directory-excursion "src/github.com/docker/cli/contrib/completion"
650 (install-file "bash/docker"
651 (string-append etc "/bash_completion.d"))
652 (install-file "fish/docker.fish"
653 (string-append etc "/fish/completions"))
654 (install-file "zsh/_docker"
655 (string-append etc "/zsh/site-functions")))
656 (install-file "build/docker" out-bin)
657 #t))))))
658 (native-inputs
659 (list go libltdl pkg-config))
660 (synopsis "Command line interface to Docker")
661 (description "This package provides a command line interface to Docker.")
662 (home-page "https://www.docker.com/")
663 (license license:asl2.0)))
664
665 (define-public cqfd
666 (package
667 (name "cqfd")
668 (version "5.3.0")
669 (source (origin
670 (method git-fetch)
671 (uri (git-reference
672 (url "https://github.com/savoirfairelinux/cqfd")
673 (commit (string-append "v" version))))
674 (file-name (git-file-name name version))
675 (sha256
676 (base32
677 "0gy4kjy6v52acfk6ffbg5sp02k6176khhkms7zlwmywq8591bpww"))))
678 (build-system gnu-build-system)
679 (arguments
680 ;; The test suite requires a docker daemon and connectivity.
681 `(#:tests? #f
682 #:phases
683 (modify-phases %standard-phases
684 (delete 'configure)
685 (delete 'build)
686 (replace 'install
687 (lambda* (#:key outputs #:allow-other-keys)
688 (let ((out (assoc-ref outputs "out")))
689 ;; Fix the directory of the bash completion.
690 (substitute* "Makefile"
691 (("completionsdir=.*$")
692 (string-append "completionsdir=" out
693 "/etc/bash_completion.d; \\\n")))
694 (invoke "make" "install"
695 (string-append "PREFIX=" out))))))))
696 (home-page "https://github.com/savoirfairelinux/cqfd")
697 (synopsis "Convenience wrapper for Docker")
698 (description "cqfd is a Bash script that provides a quick and convenient
699 way to run commands in the current directory, but within a Docker container
700 defined in a per-project configuration file.")
701 (license license:gpl3+)))
702
703 (define-public tini
704 (package
705 (name "tini")
706 (version "0.19.0")
707 (source (origin
708 (method git-fetch)
709 (uri (git-reference
710 (url "https://github.com/krallin/tini")
711 (commit (string-append "v" version))))
712 (file-name (git-file-name name version))
713 (sha256
714 (base32
715 "1hnnvjydg7gi5gx6nibjjdnfipblh84qcpajc08nvr44rkzswck4"))))
716 (build-system cmake-build-system)
717 (arguments
718 `(#:tests? #f ;tests require a Docker daemon
719 ;; 'tini-static' is a static binary, which leads CMake to fail with
720 ;; ‘file RPATH_CHANGE could not write new RPATH: ...’. Clear
721 ;; CMAKE_INSTALL_RPATH to avoid that problem.
722 #:configure-flags '("-DCMAKE_INSTALL_RPATH=")))
723 (home-page "https://github.com/krallin/tini")
724 (synopsis "Tiny but valid init for containers")
725 (description "Tini is an init program specifically designed for use with
726 containers. It manages a single child process and ensures that any zombie
727 processes produced from it are reaped and that signals are properly forwarded.
728 Tini is integrated with Docker.")
729 (license license:expat)))