Commit | Line | Data |
---|---|---|
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> |
15c3aa09 | 6 | ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de> |
d020bfc2 DT |
7 | ;;; |
8 | ;;; This file is part of GNU Guix. | |
9 | ;;; | |
10 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
11 | ;;; under the terms of the GNU General Public License as published by | |
12 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
13 | ;;; your option) any later version. | |
14 | ;;; | |
15 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
16 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | ;;; GNU General Public License for more details. | |
19 | ;;; | |
20 | ;;; You should have received a copy of the GNU General Public License | |
21 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
22 | ||
23 | (define-module (gnu packages docker) | |
24 | #:use-module ((guix licenses) #:prefix license:) | |
25 | #:use-module (gnu packages) | |
26 | #:use-module (guix packages) | |
27 | #:use-module (guix download) | |
28 | #:use-module (guix git-download) | |
92086eed | 29 | #:use-module (guix build-system cmake) |
f87ea24a | 30 | #:use-module (guix build-system gnu) |
4e5b8f72 | 31 | #:use-module (guix build-system go) |
d020bfc2 DT |
32 | #:use-module (guix build-system python) |
33 | #:use-module (guix utils) | |
e9b31645 | 34 | #:use-module (gnu packages autotools) |
58adcaa1 | 35 | #:use-module (gnu packages base) |
42531fd3 | 36 | #:use-module (gnu packages check) |
f87ea24a | 37 | #:use-module (gnu packages compression) |
6b6a25d4 | 38 | #:use-module (gnu packages glib) |
4e5b8f72 DM |
39 | #:use-module (gnu packages golang) |
40 | #:use-module (gnu packages linux) | |
0b94911a | 41 | #:use-module (gnu packages networking) |
4e5b8f72 | 42 | #:use-module (gnu packages pkg-config) |
1b2f753d | 43 | #:use-module (gnu packages python) |
3146b6da | 44 | #:use-module (gnu packages python-crypto) |
1f1e338a | 45 | #:use-module (gnu packages python-web) |
44d10b1f | 46 | #:use-module (gnu packages python-xyz) |
6b6a25d4 | 47 | #:use-module (gnu packages version-control) |
1f1e338a | 48 | #:use-module (gnu packages virtualization)) |
d020bfc2 | 49 | |
f255a193 | 50 | (define %docker-version "19.03.7") |
f87ea24a | 51 | |
d020bfc2 DT |
52 | (define-public python-docker-py |
53 | (package | |
54 | (name "python-docker-py") | |
3146b6da | 55 | (version "3.7.3") |
d020bfc2 DT |
56 | (source |
57 | (origin | |
58 | (method url-fetch) | |
3146b6da | 59 | (uri (pypi-uri "docker" version)) |
d020bfc2 DT |
60 | (sha256 |
61 | (base32 | |
3146b6da | 62 | "0qmrcvpaz37p85hfddsd4yc8hgqlkzs4cz09q9wmy0pz5pwajqm0")))) |
d020bfc2 DT |
63 | (build-system python-build-system) |
64 | ;; TODO: Tests require a running Docker daemon. | |
65 | (arguments '(#:tests? #f)) | |
66 | (inputs | |
3146b6da | 67 | `(("python-requests" ,python-requests-2.20) |
3146b6da | 68 | ("python-ipaddress" ,python-ipaddress) |
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 | |
78 | management 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 | |
98 | pseudo-terminal (PTY) allocated to a Docker container using the Python | |
99 | client.") | |
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) |
f24276de | 119 | ("python-docker-py" ,python-docker-py) |
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 | |
131 | multi-container Docker applications. A Compose file is used to configure an | |
132 | application’s services. Then, using a single command, the containers are | |
133 | created 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 | |
169 | store API. It allows programmers to interact with a Docker registry using | |
170 | Python 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 | |
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. |
238 | It includes image transfer and storage, container execution and supervision, | |
239 | network 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 | |
259 | (url "https://github.com/docker/libnetwork.git") | |
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 | |
276 | connecting containers. The goal of @code{libnetwork} is to deliver a robust | |
277 | container network model that provides a consistent programming interface and | |
278 | the 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 | |
300 | built-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 | |
313 | (url "https://github.com/docker/engine.git") | |
314 | (commit (string-append "v" version)))) | |
315 | (file-name (git-file-name name version)) | |
316 | (sha256 | |
f255a193 | 317 | (base32 "1sik109lxmiwgrsnvfip1nnal1xkh8z1mlvys6aknjyh29ll1iq8")) |
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"))) | |
f87ea24a | 393 | (let ((source-files (filter (lambda (name) |
c6279326 MC |
394 | (not (string-contains name "test"))) |
395 | (find-files "." "\\.go$")))) | |
a01d54f3 MC |
396 | (let-syntax ((substitute-LookPath* |
397 | (syntax-rules () | |
398 | ((_ (source-text package relative-path) ...) | |
399 | (substitute* source-files | |
400 | (((string-append "\\<exec\\.LookPath\\(\"" | |
401 | source-text | |
402 | "\")")) | |
403 | (string-append "\"" | |
404 | (assoc-ref inputs package) | |
405 | "/" relative-path | |
406 | "\", error(nil)")) ...)))) | |
407 | (substitute-Command* | |
408 | (syntax-rules () | |
409 | ((_ (source-text package relative-path) ...) | |
410 | (substitute* source-files | |
411 | (((string-append "\\<(re)?exec\\.Command\\(\"" | |
412 | source-text | |
413 | "\"") _ re?) | |
414 | (string-append (if re? re? "") | |
415 | "exec.Command(\"" | |
416 | (assoc-ref inputs package) | |
417 | "/" relative-path | |
418 | "\"")) ...))))) | |
419 | (substitute-LookPath* | |
8c7eb584 | 420 | ("containerd" "containerd" "bin/containerd") |
a01d54f3 MC |
421 | ("ps" "procps" "bin/ps") |
422 | ("mkfs.xfs" "xfsprogs" "bin/mkfs.xfs") | |
423 | ("lvmdiskscan" "lvm2" "sbin/lvmdiskscan") | |
424 | ("pvdisplay" "lvm2" "sbin/pvdisplay") | |
425 | ("blkid" "util-linux" "sbin/blkid") | |
426 | ("unpigz" "pigz" "bin/unpigz") | |
427 | ("iptables" "iptables" "sbin/iptables") | |
428 | ("iptables-legacy" "iptables" "sbin/iptables") | |
429 | ("ip" "iproute2" "sbin/ip")) | |
430 | ||
431 | (substitute-Command* | |
432 | ("modprobe" "kmod" "bin/modprobe") | |
433 | ("pvcreate" "lvm2" "sbin/pvcreate") | |
434 | ("vgcreate" "lvm2" "sbin/vgcreate") | |
435 | ("lvcreate" "lvm2" "sbin/lvcreate") | |
436 | ("lvconvert" "lvm2" "sbin/lvconvert") | |
437 | ("lvchange" "lvm2" "sbin/lvchange") | |
438 | ("mkfs.xfs" "xfsprogs" "sbin/mkfs.xfs") | |
439 | ("xfs_growfs" "xfsprogs" "sbin/xfs_growfs") | |
440 | ("mkfs.ext4" "e2fsprogs" "sbin/mkfs.ext4") | |
441 | ("tune2fs" "e2fsprogs" "sbin/tune2fs") | |
442 | ("blkid" "util-linux" "sbin/blkid") | |
443 | ("resize2fs" "e2fsprogs" "sbin/resize2fs") | |
444 | ("ps" "procps" "bin/ps") | |
445 | ("losetup" "util-linux" "sbin/losetup") | |
446 | ("uname" "coreutils" "bin/uname") | |
447 | ("dbus-launch" "dbus" "bin/dbus-launch") | |
448 | ("git" "git" "bin/git"))) | |
449 | ;; docker-mountfrom ?? | |
450 | ;; docker | |
451 | ;; docker-untar ?? | |
452 | ;; docker-applyLayer ?? | |
453 | ;; /usr/bin/uname | |
454 | ;; grep | |
455 | ;; apparmor_parser | |
456 | ||
65a7e35c DM |
457 | ;; Make compilation fail when, in future versions, Docker |
458 | ;; invokes other programs we don't know about and thus don't | |
459 | ;; substitute. | |
460 | (substitute* source-files | |
c6279326 | 461 | ;; Search for Java in PATH. |
1b14e1bc MC |
462 | (("\\<exec\\.Command\\(\"java\"") |
463 | "xxec.Command(\"java\"") | |
c6279326 | 464 | ;; Search for AUFS in PATH (mainline Linux doesn't support it). |
1b14e1bc MC |
465 | (("\\<exec\\.Command\\(\"auplink\"") |
466 | "xxec.Command(\"auplink\"") | |
c6279326 MC |
467 | ;; Fail on other unsubstituted commands. |
468 | (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\"" | |
1b14e1bc | 469 | _ executable) |
c6279326 | 470 | (string-append "exec.Guix_doesnt_want_Command(\"" |
1b14e1bc | 471 | executable "\"")) |
c6279326 MC |
472 | (("\\<xxec\\.Command") |
473 | "exec.Command") | |
474 | ;; Search for ZFS in PATH. | |
475 | (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")") | |
476 | ;; Fail on other unsubstituted LookPaths. | |
1b14e1bc | 477 | (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"") |
c6279326 | 478 | (("\\<LooxPath") "LookPath"))) |
f87ea24a DM |
479 | #t)) |
480 | (add-after 'patch-paths 'delete-failing-tests | |
481 | (lambda _ | |
482 | ;; Needs internet access. | |
483 | (delete-file "builder/remotecontext/git/gitutils_test.go") | |
484 | ;; Permission denied. | |
485 | (delete-file "daemon/graphdriver/devmapper/devmapper_test.go") | |
486 | ;; Operation not permitted (idtools.MkdirAllAndChown). | |
487 | (delete-file "daemon/graphdriver/vfs/vfs_test.go") | |
488 | ;; Timeouts after 5 min. | |
489 | (delete-file "plugin/manager_linux_test.go") | |
8cd95860 | 490 | ;; Operation not permitted. |
74bf1b5d | 491 | (delete-file "daemon/graphdriver/btrfs/btrfs_test.go") |
8cd95860 DM |
492 | (delete-file "daemon/graphdriver/overlay/overlay_test.go") |
493 | (delete-file "daemon/graphdriver/overlay2/overlay_test.go") | |
5b050bc2 | 494 | (delete-file "pkg/chrootarchive/archive_unix_test.go") |
eef20279 DM |
495 | (delete-file "daemon/container_unix_test.go") |
496 | ;; This file uses cgroups and /proc. | |
497 | (delete-file "pkg/sysinfo/sysinfo_linux_test.go") | |
498 | ;; This file uses cgroups. | |
499 | (delete-file "runconfig/config_test.go") | |
500 | ;; This file uses /var. | |
501 | (delete-file "daemon/oci_linux_test.go") | |
f87ea24a DM |
502 | #t)) |
503 | (replace 'configure | |
504 | (lambda _ | |
505 | (setenv "DOCKER_GITCOMMIT" (string-append "v" ,%docker-version)) | |
451c38b7 | 506 | (setenv "VERSION" (string-append ,%docker-version "-ce")) |
f87ea24a DM |
507 | ;; Automatically use bundled dependencies. |
508 | ;; TODO: Unbundle - see file "vendor.conf". | |
509 | (setenv "AUTO_GOPATH" "1") | |
510 | ;; Respectively, strip the symbol table and debug | |
511 | ;; information, and the DWARF symbol table. | |
512 | (setenv "LDFLAGS" "-s -w") | |
513 | ;; Make build faster | |
514 | (setenv "GOCACHE" "/tmp") | |
515 | #t)) | |
e3900a4d LF |
516 | (add-before 'build 'setup-go-environment |
517 | (assoc-ref go:%standard-phases 'setup-go-environment)) | |
f87ea24a DM |
518 | (replace 'build |
519 | (lambda _ | |
520 | ;; Our LD doesn't like the statically linked relocatable things | |
521 | ;; that go produces, so install the dynamic version of | |
522 | ;; dockerd instead. | |
523 | (invoke "hack/make.sh" "dynbinary"))) | |
524 | (replace 'check | |
525 | (lambda _ | |
526 | ;; The build process generated a file because the environment | |
527 | ;; variable "AUTO_GOPATH" was set. Use it. | |
528 | (setenv "GOPATH" (string-append (getcwd) "/.gopath")) | |
529 | ;; ".gopath/src/github.com/docker/docker" is a link to the current | |
530 | ;; directory and chdir would canonicalize to that. | |
531 | ;; But go needs to have the uncanonicalized directory name, so | |
532 | ;; store that. | |
533 | (setenv "PWD" (string-append (getcwd) | |
c6279326 | 534 | "/.gopath/src/github.com/docker/docker")) |
f87ea24a DM |
535 | (with-directory-excursion ".gopath/src/github.com/docker/docker" |
536 | (invoke "hack/test/unit")) | |
537 | (setenv "PWD" #f) | |
538 | #t)) | |
539 | (replace 'install | |
540 | (lambda* (#:key outputs #:allow-other-keys) | |
541 | (let* ((out (assoc-ref outputs "out")) | |
542 | (out-bin (string-append out "/bin"))) | |
543 | (install-file "bundles/dynbinary-daemon/dockerd" out-bin) | |
451c38b7 DM |
544 | (install-file (string-append "bundles/dynbinary-daemon/dockerd-" |
545 | (getenv "VERSION")) | |
546 | out-bin) | |
f87ea24a DM |
547 | #t)))))) |
548 | (inputs | |
549 | `(("btrfs-progs" ,btrfs-progs) | |
c6279326 | 550 | ("containerd" ,containerd) ; for containerd-shim |
58adcaa1 | 551 | ("coreutils" ,coreutils) |
6b6a25d4 | 552 | ("dbus" ,dbus) |
80fec17f | 553 | ("docker-proxy" ,docker-libnetwork-cmd-proxy) |
58adcaa1 | 554 | ("e2fsprogs" ,e2fsprogs) |
6b6a25d4 | 555 | ("git" ,git) |
f87ea24a DM |
556 | ("iproute2" ,iproute) |
557 | ("iptables" ,iptables) | |
58adcaa1 | 558 | ("kmod" ,kmod) |
f87ea24a DM |
559 | ("libseccomp" ,libseccomp) |
560 | ("pigz" ,pigz) | |
561 | ("procps" ,procps) | |
58adcaa1 | 562 | ("runc" ,runc) |
f87ea24a DM |
563 | ("util-linux" ,util-linux) |
564 | ("lvm2" ,lvm2) | |
b8e7e208 | 565 | ("tini" ,tini) |
59781b32 MC |
566 | ("xfsprogs" ,xfsprogs) |
567 | ("xz" ,xz))) | |
f87ea24a | 568 | (native-inputs |
c6279326 | 569 | `(("eudev" ,eudev) ; TODO: Should be propagated by lvm2 (.pc -> .pc) |
f87ea24a | 570 | ("go" ,go) |
8c7eb584 | 571 | ("gotestsum" ,gotestsum) |
f87ea24a DM |
572 | ("pkg-config" ,pkg-config))) |
573 | (synopsis "Docker container component library, and daemon") | |
574 | (description "This package provides a framework to assemble specialized | |
575 | container systems. It includes components for orchestration, image | |
576 | management, secret management, configuration management, networking, | |
577 | provisioning etc.") | |
578 | (home-page "https://mobyproject.org/") | |
579 | (license license:asl2.0))) | |
e9b31645 DM |
580 | |
581 | (define-public docker-cli | |
582 | (package | |
583 | (name "docker-cli") | |
584 | (version %docker-version) | |
585 | (source | |
586 | (origin | |
587 | (method git-fetch) | |
588 | (uri (git-reference | |
589 | (url "https://github.com/docker/cli.git") | |
590 | (commit (string-append "v" version)))) | |
591 | (file-name (git-file-name name version)) | |
592 | (sha256 | |
f255a193 | 593 | (base32 "164l33npy8acdbbrz8vcyiwx18vi55wwwikkasg0w43b5bdhz8sx")))) |
e9b31645 DM |
594 | (build-system go-build-system) |
595 | (arguments | |
596 | `(#:import-path "github.com/docker/cli" | |
597 | ;; TODO: Tests require a running Docker daemon. | |
598 | #:tests? #f | |
599 | #:phases | |
600 | (modify-phases %standard-phases | |
601 | (add-before 'build 'setup-environment-2 | |
602 | (lambda _ | |
603 | ;; Respectively, strip the symbol table and debug | |
604 | ;; information, and the DWARF symbol table. | |
605 | (setenv "LDFLAGS" "-s -w") | |
606 | ||
e9200377 MB |
607 | ;; Make sure "docker -v" prints a usable version string. |
608 | (setenv "VERSION" ,%docker-version) | |
609 | ||
e9b31645 DM |
610 | ;; Make build reproducible. |
611 | (setenv "BUILDTIME" "1970-01-01 00:00:01.000000000+00:00") | |
612 | (symlink "src/github.com/docker/cli/scripts" "./scripts") | |
613 | (symlink "src/github.com/docker/cli/docker.Makefile" "./docker.Makefile") | |
614 | #t)) | |
615 | (replace 'build | |
616 | (lambda _ | |
617 | (invoke "./scripts/build/dynbinary"))) | |
618 | (replace 'check | |
619 | (lambda* (#:key make-flags tests? #:allow-other-keys) | |
620 | (setenv "PATH" (string-append (getcwd) "/build:" (getenv "PATH"))) | |
621 | (if tests? | |
622 | ;; Use the newly-built docker client for the tests. | |
623 | (with-directory-excursion "src/github.com/docker/cli" | |
624 | ;; TODO: Run test-e2e as well? | |
625 | (apply invoke "make" "-f" "docker.Makefile" "test-unit" | |
626 | (or make-flags '()))) | |
627 | #t))) | |
628 | (replace 'install | |
629 | (lambda* (#:key outputs #:allow-other-keys) | |
630 | (let* ((out (assoc-ref outputs "out")) | |
449dc8b7 OP |
631 | (out-bin (string-append out "/bin")) |
632 | (etc (string-append out "/etc"))) | |
633 | (with-directory-excursion "src/github.com/docker/cli/contrib/completion" | |
634 | (install-file "bash/docker" | |
635 | (string-append etc "/bash_completion.d")) | |
636 | (install-file "fish/docker.fish" | |
637 | (string-append etc "/fish/completions")) | |
638 | (install-file "zsh/_docker" | |
639 | (string-append etc "/zsh/site-functions"))) | |
e9b31645 | 640 | (chdir "build") |
e9b31645 DM |
641 | (install-file "docker" out-bin) |
642 | #t)))))) | |
643 | (native-inputs | |
644 | `(("go" ,go) | |
645 | ("libltdl" ,libltdl) | |
646 | ("pkg-config" ,pkg-config))) | |
647 | (synopsis "Command line interface to Docker") | |
648 | (description "This package provides a command line interface to Docker.") | |
17d25019 | 649 | (home-page "https://www.docker.com/") |
e9b31645 | 650 | (license license:asl2.0))) |
975a953b MC |
651 | |
652 | (define-public cqfd | |
653 | (package | |
654 | (name "cqfd") | |
112fd34f | 655 | (version "5.1.0") |
975a953b MC |
656 | (source (origin |
657 | (method git-fetch) | |
658 | (uri (git-reference | |
659 | (url "https://github.com/savoirfairelinux/cqfd.git") | |
660 | (commit (string-append "v" version)))) | |
661 | (file-name (git-file-name name version)) | |
662 | (sha256 | |
663 | (base32 | |
112fd34f | 664 | "1xhydz01f2rrnw7rmnaxh3f3q1ariq7j2ig0i0w1p3wn10l3q0nv")))) |
975a953b MC |
665 | (build-system gnu-build-system) |
666 | (arguments | |
667 | ;; The test suite requires a docker daemon and connectivity. | |
668 | `(#:tests? #f | |
669 | #:phases | |
670 | (modify-phases %standard-phases | |
671 | (delete 'configure) | |
672 | (delete 'build) | |
673 | (replace 'install | |
674 | (lambda* (#:key outputs #:allow-other-keys) | |
675 | (let ((out (assoc-ref outputs "out"))) | |
676 | ;; Fix the directory of the bash completion. | |
677 | (substitute* "Makefile" | |
678 | (("completionsdir=.*$") | |
679 | (string-append "completionsdir=" out | |
680 | "/etc/bash_completion.d; \\\n"))) | |
681 | (invoke "make" "install" | |
682 | (string-append "PREFIX=" out)))))))) | |
683 | (home-page "https://github.com/savoirfairelinux/cqfd") | |
684 | (synopsis "Convenience wrapper for Docker") | |
685 | (description "cqfd is a Bash script that provides a quick and convenient | |
112fd34f | 686 | way to run commands in the current directory, but within a Docker container |
975a953b MC |
687 | defined in a per-project configuration file.") |
688 | (license license:gpl3+))) | |
92086eed MC |
689 | |
690 | (define-public tini | |
691 | (package | |
692 | (name "tini") | |
693 | (version "0.18.0") | |
694 | (source (origin | |
695 | (method git-fetch) | |
696 | (uri (git-reference | |
697 | (url "https://github.com/krallin/tini.git") | |
698 | (commit (string-append "v" version)))) | |
699 | (file-name (git-file-name name version)) | |
700 | (sha256 | |
701 | (base32 | |
702 | "1h20i3wwlbd8x4jr2gz68hgklh0lb0jj7y5xk1wvr8y58fip1rdn")))) | |
703 | (build-system cmake-build-system) | |
704 | (arguments | |
705 | `(#:tests? #f ;tests require a Docker daemon | |
706 | #:phases (modify-phases %standard-phases | |
707 | (add-after 'unpack 'disable-static-build | |
708 | ;; Disable the static build as it fails to install, with | |
709 | ;; the error: "No valid ELF RPATH or RUNPATH entry exists | |
710 | ;; in the file". | |
711 | (lambda _ | |
712 | (substitute* "CMakeLists.txt" | |
713 | ((".*tini-static.*") "")) | |
714 | #t))))) | |
715 | (home-page "https://github.com/krallin/tini") | |
716 | (synopsis "Tiny but valid init for containers") | |
717 | (description "Tini is an init program specifically designed for use with | |
718 | containers. It manages a single child process and ensures that any zombie | |
719 | processes produced from it are reaped and that signals are properly forwarded. | |
720 | Tini is integrated with Docker.") | |
721 | (license license:expat))) |