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