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