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