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