gnu: whois: Update to 5.5.3.
[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>
26b7d23a 4;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
975a953b 5;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
d020bfc2
DT
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages docker)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (gnu packages)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
92086eed 28 #:use-module (guix build-system cmake)
f87ea24a 29 #:use-module (guix build-system gnu)
4e5b8f72 30 #:use-module (guix build-system go)
d020bfc2
DT
31 #:use-module (guix build-system python)
32 #:use-module (guix utils)
e9b31645 33 #:use-module (gnu packages autotools)
58adcaa1 34 #:use-module (gnu packages base)
42531fd3 35 #:use-module (gnu packages check)
f87ea24a 36 #:use-module (gnu packages compression)
6b6a25d4 37 #:use-module (gnu packages glib)
4e5b8f72
DM
38 #:use-module (gnu packages golang)
39 #:use-module (gnu packages linux)
0b94911a 40 #:use-module (gnu packages networking)
4e5b8f72 41 #:use-module (gnu packages pkg-config)
1b2f753d 42 #:use-module (gnu packages python)
3146b6da 43 #:use-module (gnu packages python-crypto)
1f1e338a 44 #:use-module (gnu packages python-web)
44d10b1f 45 #:use-module (gnu packages python-xyz)
6b6a25d4 46 #:use-module (gnu packages version-control)
1f1e338a 47 #:use-module (gnu packages virtualization))
d020bfc2 48
0e84987f 49(define %docker-version "18.09.5")
f87ea24a 50
d020bfc2
DT
51(define-public python-docker-py
52 (package
53 (name "python-docker-py")
3146b6da 54 (version "3.7.3")
d020bfc2
DT
55 (source
56 (origin
57 (method url-fetch)
3146b6da 58 (uri (pypi-uri "docker" version))
d020bfc2
DT
59 (sha256
60 (base32
3146b6da 61 "0qmrcvpaz37p85hfddsd4yc8hgqlkzs4cz09q9wmy0pz5pwajqm0"))))
d020bfc2
DT
62 (build-system python-build-system)
63 ;; TODO: Tests require a running Docker daemon.
64 (arguments '(#:tests? #f))
65 (inputs
3146b6da 66 `(("python-requests" ,python-requests-2.20)
3146b6da 67 ("python-ipaddress" ,python-ipaddress)
d020bfc2 68 ("python-six" ,python-six)
3146b6da 69 ("python-urllib3" ,python-urllib3-1.24)
d020bfc2 70 ("python-websocket-client" ,python-websocket-client)))
d12578f2
TGR
71 (propagated-inputs
72 `(("python-docker-pycreds" ,python-docker-pycreds)
73 ("python-paramiko" ,python-paramiko))) ; adds SSH support
d020bfc2
DT
74 (home-page "https://github.com/docker/docker-py/")
75 (synopsis "Python client for Docker")
76 (description "Docker-Py is a Python client for the Docker container
77management tool.")
78 (license license:asl2.0)))
b42c9c81
DT
79
80(define-public python-dockerpty
81 (package
82 (name "python-dockerpty")
8bb591d4 83 (version "0.4.1")
b42c9c81
DT
84 (source
85 (origin
86 (method url-fetch)
87 (uri (pypi-uri "dockerpty" version))
88 (sha256
89 (base32
8bb591d4 90 "1kjn64wx23jmr8dcc6g7bwlmrhfmxr77gh6iphqsl39sayfxdab9"))))
b42c9c81
DT
91 (build-system python-build-system)
92 (native-inputs
93 `(("python-six" ,python-six)))
94 (home-page "https://github.com/d11wtq/dockerpty")
95 (synopsis "Python library to use the pseudo-TTY of a Docker container")
96 (description "Docker PTY provides the functionality needed to operate the
97pseudo-terminal (PTY) allocated to a Docker container using the Python
98client.")
99 (license license:asl2.0)))
df1f1d69 100
914bba28
TGR
101;; When updating, check whether python-jsonschema-2.6 can be removed from Guix
102;; entirely.
df1f1d69
DT
103(define-public docker-compose
104 (package
105 (name "docker-compose")
f24276de 106 (version "1.24.1")
df1f1d69
DT
107 (source
108 (origin
109 (method url-fetch)
110 (uri (pypi-uri "docker-compose" version))
111 (sha256
112 (base32
f24276de 113 "0lx7bx6jvhydbab8vwry0bclhdf0dfj6jrns1m5y45yp9ybqxmd5"))))
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)
914bba28 123 ("python-jsonschema" ,python-jsonschema-2.6)
df1f1d69 124 ("python-pyyaml" ,python-pyyaml)
f24276de 125 ("python-requests" ,python-requests-2.20)
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
182 (url "https://github.com/containerd/containerd.git")
183 (commit (string-append "v" version))))
184 (file-name (git-file-name name version))
185 (sha256
a333cbf1 186 (base32 "0npbzixf3c0jvzm159vygvkydrr8h36c9sq50yv0mdinrys2bvg0"))))
4e5b8f72
DM
187 (build-system go-build-system)
188 (arguments
189 `(#:import-path "github.com/containerd/containerd"
4e5b8f72
DM
190 #:phases
191 (modify-phases %standard-phases
192 (add-before 'build 'chdir
193 (lambda _
194 (chdir "src/github.com/containerd/containerd")
195 #t))
196 (add-after 'chdir 'patch-paths
197 (lambda* (#:key inputs outputs #:allow-other-keys)
198 ;; TODO: Patch "socat", "unpigz".
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")))
8b487bf8
DM
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\""))) ;)
4e5b8f72
DM
218 #t))
219 (replace 'build
220 (lambda* (#:key (make-flags '()) #:allow-other-keys)
221 (apply invoke "make" make-flags)))
222 (replace 'install
223 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
224 (let* ((out (assoc-ref outputs "out")))
225 (apply invoke "make" (string-append "DESTDIR=" out) "install"
226 make-flags)))))))
227 (inputs
228 `(("btrfs-progs" ,btrfs-progs)
229 ("libseccomp" ,libseccomp)
8b487bf8
DM
230 ("runc" ,runc)
231 ("util-linux" ,util-linux)))
4e5b8f72
DM
232 (native-inputs
233 `(("go" ,go)
234 ("pkg-config" ,pkg-config)))
40c7476a 235 (synopsis "Docker container runtime")
4e5b8f72
DM
236 (description "This package provides the container daemon for Docker.
237It includes image transfer and storage, container execution and supervision,
238network attachments.")
239 (home-page "http://containerd.io/")
240 (license license:asl2.0)))
f87ea24a 241
9c0244ab
MC
242;;; Private package that shouldn't be used directly; its purposes is to be
243;;; used as a template for the various packages it contains. It doesn't build
244;;; anyway, as it needs many dependencies that aren't being satisfied.
245(define docker-libnetwork
246 ;; There are no recent release for libnetwork, so choose the last commit of
247 ;; the branch that Docker uses, as can be seen in the Docker source file
248 ;; 'hack/dockerfile/install/proxy.installer'.
249 (let ((commit "4725f2163fb214a6312f3beae5991f838ec36326")
250 (version "18.09")
251 (revision "1"))
252 (package
253 (name "docker-libnetwork")
254 (version (git-version version "1" commit))
255 (source (origin
256 (method git-fetch)
257 (uri (git-reference
258 (url "https://github.com/docker/libnetwork.git")
259 (commit commit)))
260 (file-name (git-file-name name version))
261 (sha256
262 (base32
263 "1zpnxki8qfzha6ljahpwd3vkzmjhsvkmf73w6crm4ilxxw5vnpfb"))
264 ;; Delete bundled ("vendored") free software source code.
265 (modules '((guix build utils)))
266 (snippet '(begin
267 (delete-file-recursively "vendor")
268 #t))))
269 (build-system go-build-system)
270 (arguments
271 `(#:import-path "github.com/docker/libnetwork/"))
272 (home-page "https://github.com/docker/libnetwork/")
273 (synopsis "Networking for containers")
274 (description "Libnetwork provides a native Go implementation for
275connecting containers. The goal of @code{libnetwork} is to deliver a robust
276container network model that provides a consistent programming interface and
277the required network abstractions for applications.")
278 (license license:asl2.0))))
279
0b94911a
MC
280(define-public docker-libnetwork-cmd-proxy
281 (package
282 (inherit docker-libnetwork)
283 (name "docker-libnetwork-cmd-proxy")
284 (arguments
285 `(#:import-path "github.com/docker/libnetwork/cmd/proxy"
286 #:unpack-path "github.com/docker/libnetwork"
287 #:install-source? #f))
288 (native-inputs
289 `(("go-sctp" ,go-sctp)
290 ;; For tests.
291 ("logrus" ,go-github-com-sirupsen-logrus)
292 ("go-netlink" ,go-netlink)
293 ("go-netns" ,go-netns)
561d391b
LF
294 ("go-golang-org-x-crypto"
295 ,go-golang-org-x-crypto)
296 ("go-golang-org-x-sys" ,go-golang-org-x-sys)))
0b94911a
MC
297 (synopsis "Docker user-space proxy")
298 (description "A proxy running in the user space. It is used by the
299built-in registry server of Docker.")
300 (license license:asl2.0)))
301
516f6f55
DM
302;; TODO: Patch out modprobes for ip_vs, nf_conntrack,
303;; brige, nf_conntrack_netlink, aufs.
f87ea24a
DM
304(define-public docker
305 (package
306 (name "docker")
307 (version %docker-version)
308 (source
309 (origin
c6279326
MC
310 (method git-fetch)
311 (uri (git-reference
312 (url "https://github.com/docker/engine.git")
313 (commit (string-append "v" version))))
314 (file-name (git-file-name name version))
315 (sha256
316 (base32 "0cirpd9l2qazp2jyanwzvrkx2m98nksjdvn43ff38p89w6133ipb"))
317 (patches
318 (search-patches "docker-engine-test-noinstall.patch"
319 "docker-fix-tests.patch"
a349835e
OP
320 "docker-use-fewer-modprobes.patch"
321 "docker-adjust-tests-for-changes-in-go.patch"))))
f87ea24a
DM
322 (build-system gnu-build-system)
323 (arguments
324 `(#:modules
325 ((guix build gnu-build-system)
326 ((guix build go-build-system) #:prefix go:)
e3900a4d 327 (guix build union)
f87ea24a
DM
328 (guix build utils))
329 #:imported-modules
330 (,@%gnu-build-system-modules
e3900a4d 331 (guix build union)
f87ea24a
DM
332 (guix build go-build-system))
333 #:phases
334 (modify-phases %standard-phases
335 (add-after 'unpack 'patch-paths
336 (lambda* (#:key inputs #:allow-other-keys)
337 (substitute* "builder/builder-next/executor_unix.go"
c6279326
MC
338 (("CommandCandidates:.*runc.*")
339 (string-append "CommandCandidates: []string{\""
340 (assoc-ref inputs "runc")
341 "/sbin/runc\"},\n")))
f87ea24a 342 (substitute* "vendor/github.com/containerd/go-runc/runc.go"
c6279326
MC
343 (("DefaultCommand = .*")
344 (string-append "DefaultCommand = \""
345 (assoc-ref inputs "runc")
346 "/sbin/runc\"\n")))
f87ea24a 347 (substitute* "vendor/github.com/containerd/containerd/runtime/v1/linux/runtime.go"
c6279326
MC
348 (("defaultRuntime[ \t]*=.*")
349 (string-append "defaultRuntime = \""
350 (assoc-ref inputs "runc")
351 "/sbin/runc\"\n"))
352 (("defaultShim[ \t]*=.*")
353 (string-append "defaultShim = \""
354 (assoc-ref inputs "containerd")
355 "/bin/containerd-shim\"\n")))
f87ea24a 356 (substitute* "daemon/daemon_unix.go"
c6279326
MC
357 (("DefaultShimBinary = .*")
358 (string-append "DefaultShimBinary = \""
359 (assoc-ref inputs "containerd")
360 "/bin/containerd-shim\"\n"))
361 (("DefaultRuntimeBinary = .*")
362 (string-append "DefaultRuntimeBinary = \""
363 (assoc-ref inputs "runc")
364 "/sbin/runc\"\n"))
365 (("DefaultRuntimeName = .*")
366 (string-append "DefaultRuntimeName = \""
367 (assoc-ref inputs "runc")
368 "/sbin/runc\"\n")))
f87ea24a 369 (substitute* "daemon/config/config.go"
c6279326
MC
370 (("StockRuntimeName = .*")
371 (string-append "StockRuntimeName = \""
372 (assoc-ref inputs "runc")
b8e7e208
MC
373 "/sbin/runc\"\n"))
374 (("DefaultInitBinary = .*")
375 (string-append "DefaultInitBinary = \""
376 (assoc-ref inputs "tini")
377 "/bin/tini\"\n")))
378 (substitute* "daemon/config/config_common_unix_test.go"
379 (("expectedInitPath: \"docker-init\"")
380 (string-append "expectedInitPath: \""
381 (assoc-ref inputs "tini")
382 "/bin/tini\"")))
f87ea24a 383 (substitute* "vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go"
c6279326
MC
384 (("var defaultCommandCandidates = .*")
385 (string-append "var defaultCommandCandidates = []string{\""
386 (assoc-ref inputs "runc") "/sbin/runc\"}")))
80fec17f
MC
387 (substitute* "vendor/github.com/docker/libnetwork/portmapper/proxy.go"
388 (("var userlandProxyCommandName = .*")
389 (string-append "var userlandProxyCommandName = \""
390 (assoc-ref inputs "docker-proxy")
391 "/bin/proxy\"\n")))
59781b32
MC
392 (substitute* "pkg/archive/archive.go"
393 (("string\\{\"xz")
394 (string-append "string{\"" (assoc-ref inputs "xz") "/bin/xz")))
f87ea24a 395 (let ((source-files (filter (lambda (name)
c6279326
MC
396 (not (string-contains name "test")))
397 (find-files "." "\\.go$"))))
a01d54f3
MC
398 (let-syntax ((substitute-LookPath*
399 (syntax-rules ()
400 ((_ (source-text package relative-path) ...)
401 (substitute* source-files
402 (((string-append "\\<exec\\.LookPath\\(\""
403 source-text
404 "\")"))
405 (string-append "\""
406 (assoc-ref inputs package)
407 "/" relative-path
408 "\", error(nil)")) ...))))
409 (substitute-Command*
410 (syntax-rules ()
411 ((_ (source-text package relative-path) ...)
412 (substitute* source-files
413 (((string-append "\\<(re)?exec\\.Command\\(\""
414 source-text
415 "\"") _ re?)
416 (string-append (if re? re? "")
417 "exec.Command(\""
418 (assoc-ref inputs package)
419 "/" relative-path
420 "\"")) ...)))))
421 (substitute-LookPath*
422 ("ps" "procps" "bin/ps")
423 ("mkfs.xfs" "xfsprogs" "bin/mkfs.xfs")
424 ("lvmdiskscan" "lvm2" "sbin/lvmdiskscan")
425 ("pvdisplay" "lvm2" "sbin/pvdisplay")
426 ("blkid" "util-linux" "sbin/blkid")
427 ("unpigz" "pigz" "bin/unpigz")
428 ("iptables" "iptables" "sbin/iptables")
429 ("iptables-legacy" "iptables" "sbin/iptables")
430 ("ip" "iproute2" "sbin/ip"))
431
432 (substitute-Command*
433 ("modprobe" "kmod" "bin/modprobe")
434 ("pvcreate" "lvm2" "sbin/pvcreate")
435 ("vgcreate" "lvm2" "sbin/vgcreate")
436 ("lvcreate" "lvm2" "sbin/lvcreate")
437 ("lvconvert" "lvm2" "sbin/lvconvert")
438 ("lvchange" "lvm2" "sbin/lvchange")
439 ("mkfs.xfs" "xfsprogs" "sbin/mkfs.xfs")
440 ("xfs_growfs" "xfsprogs" "sbin/xfs_growfs")
441 ("mkfs.ext4" "e2fsprogs" "sbin/mkfs.ext4")
442 ("tune2fs" "e2fsprogs" "sbin/tune2fs")
443 ("blkid" "util-linux" "sbin/blkid")
444 ("resize2fs" "e2fsprogs" "sbin/resize2fs")
445 ("ps" "procps" "bin/ps")
446 ("losetup" "util-linux" "sbin/losetup")
447 ("uname" "coreutils" "bin/uname")
448 ("dbus-launch" "dbus" "bin/dbus-launch")
449 ("git" "git" "bin/git")))
450 ;; docker-mountfrom ??
451 ;; docker
452 ;; docker-untar ??
453 ;; docker-applyLayer ??
454 ;; /usr/bin/uname
455 ;; grep
456 ;; apparmor_parser
457
65a7e35c
DM
458 ;; Make compilation fail when, in future versions, Docker
459 ;; invokes other programs we don't know about and thus don't
460 ;; substitute.
461 (substitute* source-files
c6279326 462 ;; Search for Java in PATH.
1b14e1bc
MC
463 (("\\<exec\\.Command\\(\"java\"")
464 "xxec.Command(\"java\"")
c6279326 465 ;; Search for AUFS in PATH (mainline Linux doesn't support it).
1b14e1bc
MC
466 (("\\<exec\\.Command\\(\"auplink\"")
467 "xxec.Command(\"auplink\"")
c6279326
MC
468 ;; Fail on other unsubstituted commands.
469 (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\""
1b14e1bc 470 _ executable)
c6279326 471 (string-append "exec.Guix_doesnt_want_Command(\""
1b14e1bc 472 executable "\""))
c6279326
MC
473 (("\\<xxec\\.Command")
474 "exec.Command")
475 ;; Search for ZFS in PATH.
476 (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")")
477 ;; Fail on other unsubstituted LookPaths.
1b14e1bc 478 (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"")
c6279326 479 (("\\<LooxPath") "LookPath")))
f87ea24a
DM
480 #t))
481 (add-after 'patch-paths 'delete-failing-tests
482 (lambda _
483 ;; Needs internet access.
484 (delete-file "builder/remotecontext/git/gitutils_test.go")
485 ;; Permission denied.
486 (delete-file "daemon/graphdriver/devmapper/devmapper_test.go")
487 ;; Operation not permitted (idtools.MkdirAllAndChown).
488 (delete-file "daemon/graphdriver/vfs/vfs_test.go")
489 ;; Timeouts after 5 min.
490 (delete-file "plugin/manager_linux_test.go")
8cd95860 491 ;; Operation not permitted.
74bf1b5d 492 (delete-file "daemon/graphdriver/btrfs/btrfs_test.go")
8cd95860
DM
493 (delete-file "daemon/graphdriver/overlay/overlay_test.go")
494 (delete-file "daemon/graphdriver/overlay2/overlay_test.go")
f87ea24a
DM
495 #t))
496 (replace 'configure
497 (lambda _
498 (setenv "DOCKER_GITCOMMIT" (string-append "v" ,%docker-version))
499 ;; Automatically use bundled dependencies.
500 ;; TODO: Unbundle - see file "vendor.conf".
501 (setenv "AUTO_GOPATH" "1")
502 ;; Respectively, strip the symbol table and debug
503 ;; information, and the DWARF symbol table.
504 (setenv "LDFLAGS" "-s -w")
505 ;; Make build faster
506 (setenv "GOCACHE" "/tmp")
507 #t))
e3900a4d
LF
508 (add-before 'build 'setup-go-environment
509 (assoc-ref go:%standard-phases 'setup-go-environment))
f87ea24a
DM
510 (replace 'build
511 (lambda _
512 ;; Our LD doesn't like the statically linked relocatable things
513 ;; that go produces, so install the dynamic version of
514 ;; dockerd instead.
515 (invoke "hack/make.sh" "dynbinary")))
516 (replace 'check
517 (lambda _
518 ;; The build process generated a file because the environment
519 ;; variable "AUTO_GOPATH" was set. Use it.
520 (setenv "GOPATH" (string-append (getcwd) "/.gopath"))
521 ;; ".gopath/src/github.com/docker/docker" is a link to the current
522 ;; directory and chdir would canonicalize to that.
523 ;; But go needs to have the uncanonicalized directory name, so
524 ;; store that.
525 (setenv "PWD" (string-append (getcwd)
c6279326 526 "/.gopath/src/github.com/docker/docker"))
f87ea24a
DM
527 (with-directory-excursion ".gopath/src/github.com/docker/docker"
528 (invoke "hack/test/unit"))
529 (setenv "PWD" #f)
530 #t))
531 (replace 'install
532 (lambda* (#:key outputs #:allow-other-keys)
533 (let* ((out (assoc-ref outputs "out"))
534 (out-bin (string-append out "/bin")))
535 (install-file "bundles/dynbinary-daemon/dockerd" out-bin)
536 (install-file "bundles/dynbinary-daemon/dockerd-dev" out-bin)
537 #t))))))
538 (inputs
539 `(("btrfs-progs" ,btrfs-progs)
c6279326 540 ("containerd" ,containerd) ; for containerd-shim
58adcaa1 541 ("coreutils" ,coreutils)
6b6a25d4 542 ("dbus" ,dbus)
80fec17f 543 ("docker-proxy" ,docker-libnetwork-cmd-proxy)
58adcaa1 544 ("e2fsprogs" ,e2fsprogs)
6b6a25d4 545 ("git" ,git)
f87ea24a
DM
546 ("iproute2" ,iproute)
547 ("iptables" ,iptables)
58adcaa1 548 ("kmod" ,kmod)
f87ea24a
DM
549 ("libseccomp" ,libseccomp)
550 ("pigz" ,pigz)
551 ("procps" ,procps)
58adcaa1 552 ("runc" ,runc)
f87ea24a
DM
553 ("util-linux" ,util-linux)
554 ("lvm2" ,lvm2)
b8e7e208 555 ("tini" ,tini)
59781b32
MC
556 ("xfsprogs" ,xfsprogs)
557 ("xz" ,xz)))
f87ea24a 558 (native-inputs
c6279326 559 `(("eudev" ,eudev) ; TODO: Should be propagated by lvm2 (.pc -> .pc)
f87ea24a
DM
560 ("go" ,go)
561 ("pkg-config" ,pkg-config)))
562 (synopsis "Docker container component library, and daemon")
563 (description "This package provides a framework to assemble specialized
564container systems. It includes components for orchestration, image
565management, secret management, configuration management, networking,
566provisioning etc.")
567 (home-page "https://mobyproject.org/")
568 (license license:asl2.0)))
e9b31645
DM
569
570(define-public docker-cli
571 (package
572 (name "docker-cli")
573 (version %docker-version)
574 (source
575 (origin
576 (method git-fetch)
577 (uri (git-reference
578 (url "https://github.com/docker/cli.git")
579 (commit (string-append "v" version))))
580 (file-name (git-file-name name version))
581 (sha256
0e84987f 582 (base32 "0mxxjzkwdny8p2dmyjich7x1gn7hdlfppzjy2skk2k5bwv7nxpmi"))))
e9b31645
DM
583 (build-system go-build-system)
584 (arguments
585 `(#:import-path "github.com/docker/cli"
586 ;; TODO: Tests require a running Docker daemon.
587 #:tests? #f
588 #:phases
589 (modify-phases %standard-phases
590 (add-before 'build 'setup-environment-2
591 (lambda _
592 ;; Respectively, strip the symbol table and debug
593 ;; information, and the DWARF symbol table.
594 (setenv "LDFLAGS" "-s -w")
595
e9200377
MB
596 ;; Make sure "docker -v" prints a usable version string.
597 (setenv "VERSION" ,%docker-version)
598
e9b31645
DM
599 ;; Make build reproducible.
600 (setenv "BUILDTIME" "1970-01-01 00:00:01.000000000+00:00")
601 (symlink "src/github.com/docker/cli/scripts" "./scripts")
602 (symlink "src/github.com/docker/cli/docker.Makefile" "./docker.Makefile")
603 #t))
604 (replace 'build
605 (lambda _
606 (invoke "./scripts/build/dynbinary")))
607 (replace 'check
608 (lambda* (#:key make-flags tests? #:allow-other-keys)
609 (setenv "PATH" (string-append (getcwd) "/build:" (getenv "PATH")))
610 (if tests?
611 ;; Use the newly-built docker client for the tests.
612 (with-directory-excursion "src/github.com/docker/cli"
613 ;; TODO: Run test-e2e as well?
614 (apply invoke "make" "-f" "docker.Makefile" "test-unit"
615 (or make-flags '())))
616 #t)))
617 (replace 'install
618 (lambda* (#:key outputs #:allow-other-keys)
619 (let* ((out (assoc-ref outputs "out"))
620 (out-bin (string-append out "/bin")))
621 (chdir "build")
e9b31645
DM
622 (install-file "docker" out-bin)
623 #t))))))
624 (native-inputs
625 `(("go" ,go)
626 ("libltdl" ,libltdl)
627 ("pkg-config" ,pkg-config)))
628 (synopsis "Command line interface to Docker")
629 (description "This package provides a command line interface to Docker.")
17d25019 630 (home-page "https://www.docker.com/")
e9b31645 631 (license license:asl2.0)))
975a953b
MC
632
633(define-public cqfd
634 (package
635 (name "cqfd")
112fd34f 636 (version "5.1.0")
975a953b
MC
637 (source (origin
638 (method git-fetch)
639 (uri (git-reference
640 (url "https://github.com/savoirfairelinux/cqfd.git")
641 (commit (string-append "v" version))))
642 (file-name (git-file-name name version))
643 (sha256
644 (base32
112fd34f 645 "1xhydz01f2rrnw7rmnaxh3f3q1ariq7j2ig0i0w1p3wn10l3q0nv"))))
975a953b
MC
646 (build-system gnu-build-system)
647 (arguments
648 ;; The test suite requires a docker daemon and connectivity.
649 `(#:tests? #f
650 #:phases
651 (modify-phases %standard-phases
652 (delete 'configure)
653 (delete 'build)
654 (replace 'install
655 (lambda* (#:key outputs #:allow-other-keys)
656 (let ((out (assoc-ref outputs "out")))
657 ;; Fix the directory of the bash completion.
658 (substitute* "Makefile"
659 (("completionsdir=.*$")
660 (string-append "completionsdir=" out
661 "/etc/bash_completion.d; \\\n")))
662 (invoke "make" "install"
663 (string-append "PREFIX=" out))))))))
664 (home-page "https://github.com/savoirfairelinux/cqfd")
665 (synopsis "Convenience wrapper for Docker")
666 (description "cqfd is a Bash script that provides a quick and convenient
112fd34f 667way to run commands in the current directory, but within a Docker container
975a953b
MC
668defined in a per-project configuration file.")
669 (license license:gpl3+)))
92086eed
MC
670
671(define-public tini
672 (package
673 (name "tini")
674 (version "0.18.0")
675 (source (origin
676 (method git-fetch)
677 (uri (git-reference
678 (url "https://github.com/krallin/tini.git")
679 (commit (string-append "v" version))))
680 (file-name (git-file-name name version))
681 (sha256
682 (base32
683 "1h20i3wwlbd8x4jr2gz68hgklh0lb0jj7y5xk1wvr8y58fip1rdn"))))
684 (build-system cmake-build-system)
685 (arguments
686 `(#:tests? #f ;tests require a Docker daemon
687 #:phases (modify-phases %standard-phases
688 (add-after 'unpack 'disable-static-build
689 ;; Disable the static build as it fails to install, with
690 ;; the error: "No valid ELF RPATH or RUNPATH entry exists
691 ;; in the file".
692 (lambda _
693 (substitute* "CMakeLists.txt"
694 ((".*tini-static.*") ""))
695 #t)))))
696 (home-page "https://github.com/krallin/tini")
697 (synopsis "Tiny but valid init for containers")
698 (description "Tini is an init program specifically designed for use with
699containers. It manages a single child process and ensures that any zombie
700processes produced from it are reaped and that signals are properly forwarded.
701Tini is integrated with Docker.")
702 (license license:expat)))