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