gnu: go-gotest-tools-package: Add comment.
[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
8c7eb584 49(define %docker-version "19.03.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
8c7eb584 316 (base32 "1dlknwn0fh82nbzdzxdk6pfhqwph9vcw3vs3111wfr19y5hwncq9"))
c6279326 317 (patches
8c7eb584 318 (search-patches "docker-fix-tests.patch"))))
f87ea24a
DM
319 (build-system gnu-build-system)
320 (arguments
321 `(#:modules
322 ((guix build gnu-build-system)
323 ((guix build go-build-system) #:prefix go:)
e3900a4d 324 (guix build union)
f87ea24a
DM
325 (guix build utils))
326 #:imported-modules
327 (,@%gnu-build-system-modules
e3900a4d 328 (guix build union)
f87ea24a
DM
329 (guix build go-build-system))
330 #:phases
331 (modify-phases %standard-phases
332 (add-after 'unpack 'patch-paths
333 (lambda* (#:key inputs #:allow-other-keys)
334 (substitute* "builder/builder-next/executor_unix.go"
c6279326
MC
335 (("CommandCandidates:.*runc.*")
336 (string-append "CommandCandidates: []string{\""
337 (assoc-ref inputs "runc")
338 "/sbin/runc\"},\n")))
f87ea24a 339 (substitute* "vendor/github.com/containerd/go-runc/runc.go"
c6279326
MC
340 (("DefaultCommand = .*")
341 (string-append "DefaultCommand = \""
342 (assoc-ref inputs "runc")
343 "/sbin/runc\"\n")))
f87ea24a 344 (substitute* "vendor/github.com/containerd/containerd/runtime/v1/linux/runtime.go"
c6279326
MC
345 (("defaultRuntime[ \t]*=.*")
346 (string-append "defaultRuntime = \""
347 (assoc-ref inputs "runc")
348 "/sbin/runc\"\n"))
349 (("defaultShim[ \t]*=.*")
350 (string-append "defaultShim = \""
351 (assoc-ref inputs "containerd")
352 "/bin/containerd-shim\"\n")))
f87ea24a 353 (substitute* "daemon/daemon_unix.go"
c6279326
MC
354 (("DefaultShimBinary = .*")
355 (string-append "DefaultShimBinary = \""
356 (assoc-ref inputs "containerd")
357 "/bin/containerd-shim\"\n"))
358 (("DefaultRuntimeBinary = .*")
359 (string-append "DefaultRuntimeBinary = \""
360 (assoc-ref inputs "runc")
361 "/sbin/runc\"\n"))
362 (("DefaultRuntimeName = .*")
363 (string-append "DefaultRuntimeName = \""
364 (assoc-ref inputs "runc")
365 "/sbin/runc\"\n")))
f87ea24a 366 (substitute* "daemon/config/config.go"
c6279326
MC
367 (("StockRuntimeName = .*")
368 (string-append "StockRuntimeName = \""
369 (assoc-ref inputs "runc")
b8e7e208
MC
370 "/sbin/runc\"\n"))
371 (("DefaultInitBinary = .*")
372 (string-append "DefaultInitBinary = \""
373 (assoc-ref inputs "tini")
374 "/bin/tini\"\n")))
375 (substitute* "daemon/config/config_common_unix_test.go"
376 (("expectedInitPath: \"docker-init\"")
377 (string-append "expectedInitPath: \""
378 (assoc-ref inputs "tini")
379 "/bin/tini\"")))
f87ea24a 380 (substitute* "vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go"
c6279326
MC
381 (("var defaultCommandCandidates = .*")
382 (string-append "var defaultCommandCandidates = []string{\""
383 (assoc-ref inputs "runc") "/sbin/runc\"}")))
80fec17f
MC
384 (substitute* "vendor/github.com/docker/libnetwork/portmapper/proxy.go"
385 (("var userlandProxyCommandName = .*")
386 (string-append "var userlandProxyCommandName = \""
387 (assoc-ref inputs "docker-proxy")
388 "/bin/proxy\"\n")))
59781b32
MC
389 (substitute* "pkg/archive/archive.go"
390 (("string\\{\"xz")
391 (string-append "string{\"" (assoc-ref inputs "xz") "/bin/xz")))
f87ea24a 392 (let ((source-files (filter (lambda (name)
c6279326
MC
393 (not (string-contains name "test")))
394 (find-files "." "\\.go$"))))
a01d54f3
MC
395 (let-syntax ((substitute-LookPath*
396 (syntax-rules ()
397 ((_ (source-text package relative-path) ...)
398 (substitute* source-files
399 (((string-append "\\<exec\\.LookPath\\(\""
400 source-text
401 "\")"))
402 (string-append "\""
403 (assoc-ref inputs package)
404 "/" relative-path
405 "\", error(nil)")) ...))))
406 (substitute-Command*
407 (syntax-rules ()
408 ((_ (source-text package relative-path) ...)
409 (substitute* source-files
410 (((string-append "\\<(re)?exec\\.Command\\(\""
411 source-text
412 "\"") _ re?)
413 (string-append (if re? re? "")
414 "exec.Command(\""
415 (assoc-ref inputs package)
416 "/" relative-path
417 "\"")) ...)))))
418 (substitute-LookPath*
8c7eb584 419 ("containerd" "containerd" "bin/containerd")
a01d54f3
MC
420 ("ps" "procps" "bin/ps")
421 ("mkfs.xfs" "xfsprogs" "bin/mkfs.xfs")
422 ("lvmdiskscan" "lvm2" "sbin/lvmdiskscan")
423 ("pvdisplay" "lvm2" "sbin/pvdisplay")
424 ("blkid" "util-linux" "sbin/blkid")
425 ("unpigz" "pigz" "bin/unpigz")
426 ("iptables" "iptables" "sbin/iptables")
427 ("iptables-legacy" "iptables" "sbin/iptables")
428 ("ip" "iproute2" "sbin/ip"))
429
430 (substitute-Command*
431 ("modprobe" "kmod" "bin/modprobe")
432 ("pvcreate" "lvm2" "sbin/pvcreate")
433 ("vgcreate" "lvm2" "sbin/vgcreate")
434 ("lvcreate" "lvm2" "sbin/lvcreate")
435 ("lvconvert" "lvm2" "sbin/lvconvert")
436 ("lvchange" "lvm2" "sbin/lvchange")
437 ("mkfs.xfs" "xfsprogs" "sbin/mkfs.xfs")
438 ("xfs_growfs" "xfsprogs" "sbin/xfs_growfs")
439 ("mkfs.ext4" "e2fsprogs" "sbin/mkfs.ext4")
440 ("tune2fs" "e2fsprogs" "sbin/tune2fs")
441 ("blkid" "util-linux" "sbin/blkid")
442 ("resize2fs" "e2fsprogs" "sbin/resize2fs")
443 ("ps" "procps" "bin/ps")
444 ("losetup" "util-linux" "sbin/losetup")
445 ("uname" "coreutils" "bin/uname")
446 ("dbus-launch" "dbus" "bin/dbus-launch")
447 ("git" "git" "bin/git")))
448 ;; docker-mountfrom ??
449 ;; docker
450 ;; docker-untar ??
451 ;; docker-applyLayer ??
452 ;; /usr/bin/uname
453 ;; grep
454 ;; apparmor_parser
455
65a7e35c
DM
456 ;; Make compilation fail when, in future versions, Docker
457 ;; invokes other programs we don't know about and thus don't
458 ;; substitute.
459 (substitute* source-files
c6279326 460 ;; Search for Java in PATH.
1b14e1bc
MC
461 (("\\<exec\\.Command\\(\"java\"")
462 "xxec.Command(\"java\"")
c6279326 463 ;; Search for AUFS in PATH (mainline Linux doesn't support it).
1b14e1bc
MC
464 (("\\<exec\\.Command\\(\"auplink\"")
465 "xxec.Command(\"auplink\"")
c6279326
MC
466 ;; Fail on other unsubstituted commands.
467 (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\""
1b14e1bc 468 _ executable)
c6279326 469 (string-append "exec.Guix_doesnt_want_Command(\""
1b14e1bc 470 executable "\""))
c6279326
MC
471 (("\\<xxec\\.Command")
472 "exec.Command")
473 ;; Search for ZFS in PATH.
474 (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")")
475 ;; Fail on other unsubstituted LookPaths.
1b14e1bc 476 (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"")
c6279326 477 (("\\<LooxPath") "LookPath")))
f87ea24a
DM
478 #t))
479 (add-after 'patch-paths 'delete-failing-tests
480 (lambda _
481 ;; Needs internet access.
482 (delete-file "builder/remotecontext/git/gitutils_test.go")
483 ;; Permission denied.
484 (delete-file "daemon/graphdriver/devmapper/devmapper_test.go")
485 ;; Operation not permitted (idtools.MkdirAllAndChown).
486 (delete-file "daemon/graphdriver/vfs/vfs_test.go")
487 ;; Timeouts after 5 min.
488 (delete-file "plugin/manager_linux_test.go")
8cd95860 489 ;; Operation not permitted.
74bf1b5d 490 (delete-file "daemon/graphdriver/btrfs/btrfs_test.go")
8cd95860
DM
491 (delete-file "daemon/graphdriver/overlay/overlay_test.go")
492 (delete-file "daemon/graphdriver/overlay2/overlay_test.go")
f87ea24a
DM
493 #t))
494 (replace 'configure
495 (lambda _
496 (setenv "DOCKER_GITCOMMIT" (string-append "v" ,%docker-version))
497 ;; Automatically use bundled dependencies.
498 ;; TODO: Unbundle - see file "vendor.conf".
499 (setenv "AUTO_GOPATH" "1")
500 ;; Respectively, strip the symbol table and debug
501 ;; information, and the DWARF symbol table.
502 (setenv "LDFLAGS" "-s -w")
503 ;; Make build faster
504 (setenv "GOCACHE" "/tmp")
505 #t))
e3900a4d
LF
506 (add-before 'build 'setup-go-environment
507 (assoc-ref go:%standard-phases 'setup-go-environment))
f87ea24a
DM
508 (replace 'build
509 (lambda _
510 ;; Our LD doesn't like the statically linked relocatable things
511 ;; that go produces, so install the dynamic version of
512 ;; dockerd instead.
513 (invoke "hack/make.sh" "dynbinary")))
514 (replace 'check
515 (lambda _
516 ;; The build process generated a file because the environment
517 ;; variable "AUTO_GOPATH" was set. Use it.
518 (setenv "GOPATH" (string-append (getcwd) "/.gopath"))
519 ;; ".gopath/src/github.com/docker/docker" is a link to the current
520 ;; directory and chdir would canonicalize to that.
521 ;; But go needs to have the uncanonicalized directory name, so
522 ;; store that.
523 (setenv "PWD" (string-append (getcwd)
c6279326 524 "/.gopath/src/github.com/docker/docker"))
f87ea24a
DM
525 (with-directory-excursion ".gopath/src/github.com/docker/docker"
526 (invoke "hack/test/unit"))
527 (setenv "PWD" #f)
528 #t))
529 (replace 'install
530 (lambda* (#:key outputs #:allow-other-keys)
531 (let* ((out (assoc-ref outputs "out"))
532 (out-bin (string-append out "/bin")))
533 (install-file "bundles/dynbinary-daemon/dockerd" out-bin)
534 (install-file "bundles/dynbinary-daemon/dockerd-dev" out-bin)
535 #t))))))
536 (inputs
537 `(("btrfs-progs" ,btrfs-progs)
c6279326 538 ("containerd" ,containerd) ; for containerd-shim
58adcaa1 539 ("coreutils" ,coreutils)
6b6a25d4 540 ("dbus" ,dbus)
80fec17f 541 ("docker-proxy" ,docker-libnetwork-cmd-proxy)
58adcaa1 542 ("e2fsprogs" ,e2fsprogs)
6b6a25d4 543 ("git" ,git)
f87ea24a
DM
544 ("iproute2" ,iproute)
545 ("iptables" ,iptables)
58adcaa1 546 ("kmod" ,kmod)
f87ea24a
DM
547 ("libseccomp" ,libseccomp)
548 ("pigz" ,pigz)
549 ("procps" ,procps)
58adcaa1 550 ("runc" ,runc)
f87ea24a
DM
551 ("util-linux" ,util-linux)
552 ("lvm2" ,lvm2)
b8e7e208 553 ("tini" ,tini)
59781b32
MC
554 ("xfsprogs" ,xfsprogs)
555 ("xz" ,xz)))
f87ea24a 556 (native-inputs
c6279326 557 `(("eudev" ,eudev) ; TODO: Should be propagated by lvm2 (.pc -> .pc)
f87ea24a 558 ("go" ,go)
8c7eb584 559 ("gotestsum" ,gotestsum)
f87ea24a
DM
560 ("pkg-config" ,pkg-config)))
561 (synopsis "Docker container component library, and daemon")
562 (description "This package provides a framework to assemble specialized
563container systems. It includes components for orchestration, image
564management, secret management, configuration management, networking,
565provisioning etc.")
566 (home-page "https://mobyproject.org/")
567 (license license:asl2.0)))
e9b31645
DM
568
569(define-public docker-cli
570 (package
571 (name "docker-cli")
572 (version %docker-version)
573 (source
574 (origin
575 (method git-fetch)
576 (uri (git-reference
577 (url "https://github.com/docker/cli.git")
578 (commit (string-append "v" version))))
579 (file-name (git-file-name name version))
580 (sha256
8c7eb584 581 (base32 "07ldz46y74b3la4ah65v5bzbfx09yy6kncvxrr0zfx0s1214ar3m"))))
e9b31645
DM
582 (build-system go-build-system)
583 (arguments
584 `(#:import-path "github.com/docker/cli"
585 ;; TODO: Tests require a running Docker daemon.
586 #:tests? #f
587 #:phases
588 (modify-phases %standard-phases
589 (add-before 'build 'setup-environment-2
590 (lambda _
591 ;; Respectively, strip the symbol table and debug
592 ;; information, and the DWARF symbol table.
593 (setenv "LDFLAGS" "-s -w")
594
e9200377
MB
595 ;; Make sure "docker -v" prints a usable version string.
596 (setenv "VERSION" ,%docker-version)
597
e9b31645
DM
598 ;; Make build reproducible.
599 (setenv "BUILDTIME" "1970-01-01 00:00:01.000000000+00:00")
600 (symlink "src/github.com/docker/cli/scripts" "./scripts")
601 (symlink "src/github.com/docker/cli/docker.Makefile" "./docker.Makefile")
602 #t))
603 (replace 'build
604 (lambda _
605 (invoke "./scripts/build/dynbinary")))
606 (replace 'check
607 (lambda* (#:key make-flags tests? #:allow-other-keys)
608 (setenv "PATH" (string-append (getcwd) "/build:" (getenv "PATH")))
609 (if tests?
610 ;; Use the newly-built docker client for the tests.
611 (with-directory-excursion "src/github.com/docker/cli"
612 ;; TODO: Run test-e2e as well?
613 (apply invoke "make" "-f" "docker.Makefile" "test-unit"
614 (or make-flags '())))
615 #t)))
616 (replace 'install
617 (lambda* (#:key outputs #:allow-other-keys)
618 (let* ((out (assoc-ref outputs "out"))
449dc8b7
OP
619 (out-bin (string-append out "/bin"))
620 (etc (string-append out "/etc")))
621 (with-directory-excursion "src/github.com/docker/cli/contrib/completion"
622 (install-file "bash/docker"
623 (string-append etc "/bash_completion.d"))
624 (install-file "fish/docker.fish"
625 (string-append etc "/fish/completions"))
626 (install-file "zsh/_docker"
627 (string-append etc "/zsh/site-functions")))
e9b31645 628 (chdir "build")
e9b31645
DM
629 (install-file "docker" out-bin)
630 #t))))))
631 (native-inputs
632 `(("go" ,go)
633 ("libltdl" ,libltdl)
634 ("pkg-config" ,pkg-config)))
635 (synopsis "Command line interface to Docker")
636 (description "This package provides a command line interface to Docker.")
17d25019 637 (home-page "https://www.docker.com/")
e9b31645 638 (license license:asl2.0)))
975a953b
MC
639
640(define-public cqfd
641 (package
642 (name "cqfd")
112fd34f 643 (version "5.1.0")
975a953b
MC
644 (source (origin
645 (method git-fetch)
646 (uri (git-reference
647 (url "https://github.com/savoirfairelinux/cqfd.git")
648 (commit (string-append "v" version))))
649 (file-name (git-file-name name version))
650 (sha256
651 (base32
112fd34f 652 "1xhydz01f2rrnw7rmnaxh3f3q1ariq7j2ig0i0w1p3wn10l3q0nv"))))
975a953b
MC
653 (build-system gnu-build-system)
654 (arguments
655 ;; The test suite requires a docker daemon and connectivity.
656 `(#:tests? #f
657 #:phases
658 (modify-phases %standard-phases
659 (delete 'configure)
660 (delete 'build)
661 (replace 'install
662 (lambda* (#:key outputs #:allow-other-keys)
663 (let ((out (assoc-ref outputs "out")))
664 ;; Fix the directory of the bash completion.
665 (substitute* "Makefile"
666 (("completionsdir=.*$")
667 (string-append "completionsdir=" out
668 "/etc/bash_completion.d; \\\n")))
669 (invoke "make" "install"
670 (string-append "PREFIX=" out))))))))
671 (home-page "https://github.com/savoirfairelinux/cqfd")
672 (synopsis "Convenience wrapper for Docker")
673 (description "cqfd is a Bash script that provides a quick and convenient
112fd34f 674way to run commands in the current directory, but within a Docker container
975a953b
MC
675defined in a per-project configuration file.")
676 (license license:gpl3+)))
92086eed
MC
677
678(define-public tini
679 (package
680 (name "tini")
681 (version "0.18.0")
682 (source (origin
683 (method git-fetch)
684 (uri (git-reference
685 (url "https://github.com/krallin/tini.git")
686 (commit (string-append "v" version))))
687 (file-name (git-file-name name version))
688 (sha256
689 (base32
690 "1h20i3wwlbd8x4jr2gz68hgklh0lb0jj7y5xk1wvr8y58fip1rdn"))))
691 (build-system cmake-build-system)
692 (arguments
693 `(#:tests? #f ;tests require a Docker daemon
694 #:phases (modify-phases %standard-phases
695 (add-after 'unpack 'disable-static-build
696 ;; Disable the static build as it fails to install, with
697 ;; the error: "No valid ELF RPATH or RUNPATH entry exists
698 ;; in the file".
699 (lambda _
700 (substitute* "CMakeLists.txt"
701 ((".*tini-static.*") ""))
702 #t)))))
703 (home-page "https://github.com/krallin/tini")
704 (synopsis "Tiny but valid init for containers")
705 (description "Tini is an init program specifically designed for use with
706containers. It manages a single child process and ensures that any zombie
707processes produced from it are reaped and that signals are properly forwarded.
708Tini is integrated with Docker.")
709 (license license:expat)))