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