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