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> |
98a76dd8 | 4 | ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
7bf82f5e | 5 | ;;; Copyright © 2019, 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
15c3aa09 | 6 | ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de> |
6e9f8826 | 7 | ;;; Copyright © 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com> |
87a13a5e | 8 | ;;; Copyright © 2020 Jesse Dowell <jessedowell@gmail.com> |
b33e1a18 | 9 | ;;; Copyright © 2021, 2022 Oleg Pykhalov <go.wigust@gmail.com> |
575dffef | 10 | ;;; Copyright © 2022 Pierre Langlois <pierre.langlois@gmx.com> |
d020bfc2 DT |
11 | ;;; |
12 | ;;; This file is part of GNU Guix. | |
13 | ;;; | |
14 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
15 | ;;; under the terms of the GNU General Public License as published by | |
16 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
17 | ;;; your option) any later version. | |
18 | ;;; | |
19 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
20 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | ;;; GNU General Public License for more details. | |
23 | ;;; | |
24 | ;;; You should have received a copy of the GNU General Public License | |
25 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
26 | ||
27 | (define-module (gnu packages docker) | |
28 | #:use-module ((guix licenses) #:prefix license:) | |
29 | #:use-module (gnu packages) | |
30 | #:use-module (guix packages) | |
31 | #:use-module (guix download) | |
c37d970f | 32 | #:use-module (guix gexp) |
d020bfc2 | 33 | #:use-module (guix git-download) |
92086eed | 34 | #:use-module (guix build-system cmake) |
f87ea24a | 35 | #:use-module (guix build-system gnu) |
4e5b8f72 | 36 | #:use-module (guix build-system go) |
d020bfc2 DT |
37 | #:use-module (guix build-system python) |
38 | #:use-module (guix utils) | |
e9b31645 | 39 | #:use-module (gnu packages autotools) |
58adcaa1 | 40 | #:use-module (gnu packages base) |
42531fd3 | 41 | #:use-module (gnu packages check) |
f87ea24a | 42 | #:use-module (gnu packages compression) |
6b6a25d4 | 43 | #:use-module (gnu packages glib) |
4e5b8f72 DM |
44 | #:use-module (gnu packages golang) |
45 | #:use-module (gnu packages linux) | |
0b94911a | 46 | #:use-module (gnu packages networking) |
4e5b8f72 | 47 | #:use-module (gnu packages pkg-config) |
1b2f753d | 48 | #:use-module (gnu packages python) |
3146b6da | 49 | #:use-module (gnu packages python-crypto) |
1f1e338a | 50 | #:use-module (gnu packages python-web) |
44d10b1f | 51 | #:use-module (gnu packages python-xyz) |
6b6a25d4 | 52 | #:use-module (gnu packages version-control) |
1f1e338a | 53 | #:use-module (gnu packages virtualization)) |
d020bfc2 | 54 | |
87a13a5e JD |
55 | ;; Note - when changing Docker versions it is important to update the versions |
56 | ;; of several associated packages (docker-libnetwork and go-sctp). | |
185ae9b4 | 57 | (define %docker-version "20.10.17") |
f87ea24a | 58 | |
b8cb3eb6 | 59 | (define-public python-docker |
d020bfc2 | 60 | (package |
b8cb3eb6 | 61 | (name "python-docker") |
d3968977 | 62 | (version "5.0.3") |
d020bfc2 DT |
63 | (source |
64 | (origin | |
65 | (method url-fetch) | |
3146b6da | 66 | (uri (pypi-uri "docker" version)) |
d020bfc2 DT |
67 | (sha256 |
68 | (base32 | |
d3968977 | 69 | "1yr7w8vmdis01myx26pqx7wcyz2cy1mfs421alppq3lpc9ms45nr")))) |
d020bfc2 DT |
70 | (build-system python-build-system) |
71 | ;; TODO: Tests require a running Docker daemon. | |
72 | (arguments '(#:tests? #f)) | |
73 | (inputs | |
8394619b | 74 | (list python-requests python-six python-urllib3)) |
d12578f2 | 75 | (propagated-inputs |
8394619b LC |
76 | (list python-docker-pycreds python-paramiko ;adds SSH support |
77 | python-websocket-client)) | |
d020bfc2 DT |
78 | (home-page "https://github.com/docker/docker-py/") |
79 | (synopsis "Python client for Docker") | |
80 | (description "Docker-Py is a Python client for the Docker container | |
81 | management tool.") | |
82 | (license license:asl2.0))) | |
b42c9c81 DT |
83 | |
84 | (define-public python-dockerpty | |
85 | (package | |
86 | (name "python-dockerpty") | |
8bb591d4 | 87 | (version "0.4.1") |
b42c9c81 DT |
88 | (source |
89 | (origin | |
90 | (method url-fetch) | |
91 | (uri (pypi-uri "dockerpty" version)) | |
92 | (sha256 | |
93 | (base32 | |
8bb591d4 | 94 | "1kjn64wx23jmr8dcc6g7bwlmrhfmxr77gh6iphqsl39sayfxdab9")))) |
b42c9c81 DT |
95 | (build-system python-build-system) |
96 | (native-inputs | |
8394619b | 97 | (list python-six)) |
b42c9c81 DT |
98 | (home-page "https://github.com/d11wtq/dockerpty") |
99 | (synopsis "Python library to use the pseudo-TTY of a Docker container") | |
100 | (description "Docker PTY provides the functionality needed to operate the | |
101 | pseudo-terminal (PTY) allocated to a Docker container using the Python | |
102 | client.") | |
103 | (license license:asl2.0))) | |
df1f1d69 DT |
104 | |
105 | (define-public docker-compose | |
106 | (package | |
107 | (name "docker-compose") | |
59dd9218 | 108 | (version "1.29.2") |
df1f1d69 DT |
109 | (source |
110 | (origin | |
111 | (method url-fetch) | |
112 | (uri (pypi-uri "docker-compose" version)) | |
113 | (sha256 | |
114 | (base32 | |
59dd9218 | 115 | "1dq9kfak61xx7chjrzmkvbw9mvj9008k7g8q7mwi4x133p9dk32c")))) |
df1f1d69 DT |
116 | (build-system python-build-system) |
117 | ;; TODO: Tests require running Docker daemon. | |
118 | (arguments '(#:tests? #f)) | |
119 | (inputs | |
8394619b LC |
120 | (list python-cached-property |
121 | python-distro | |
122 | python-docker | |
123 | python-dockerpty | |
124 | python-docopt | |
125 | python-dotenv | |
126 | python-jsonschema | |
4ed48f58 | 127 | python-pyyaml-5 |
8394619b LC |
128 | python-requests |
129 | python-six | |
130 | python-texttable | |
4ccb2280 | 131 | python-websocket-client-0.59)) |
df1f1d69 DT |
132 | (home-page "https://www.docker.com/") |
133 | (synopsis "Multi-container orchestration for Docker") | |
134 | (description "Docker Compose is a tool for defining and running | |
135 | multi-container Docker applications. A Compose file is used to configure an | |
136 | application’s services. Then, using a single command, the containers are | |
137 | created and all the services are started as specified in the configuration.") | |
138 | (license license:asl2.0))) | |
42531fd3 EF |
139 | |
140 | (define-public python-docker-pycreds | |
141 | (package | |
142 | (name "python-docker-pycreds") | |
d59d56b2 | 143 | (version "0.4.0") |
42531fd3 EF |
144 | (source |
145 | (origin | |
146 | (method url-fetch) | |
147 | (uri (pypi-uri "docker-pycreds" version)) | |
148 | (sha256 | |
149 | (base32 | |
d59d56b2 | 150 | "1m44smrggnqghxkqfl7vhapdw89m1p3vdr177r6cq17lr85jgqvc")))) |
42531fd3 EF |
151 | (build-system python-build-system) |
152 | (arguments | |
153 | `(#:phases | |
154 | (modify-phases %standard-phases | |
155 | (add-after 'unpack 'fix-versioning | |
156 | (lambda _ | |
157 | (substitute* "test-requirements.txt" | |
158 | (("3.0.2") ,(package-version python-pytest)) | |
159 | (("2.3.1") ,(package-version python-pytest-cov)) | |
160 | (("2.4.1") ,(package-version python-flake8))) | |
161 | #t))))) | |
162 | (native-inputs | |
8394619b | 163 | (list python-flake8 python-pytest python-pytest-cov)) |
42531fd3 | 164 | (propagated-inputs |
8394619b | 165 | (list python-six)) |
42531fd3 EF |
166 | (home-page "https://github.com/shin-/dockerpy-creds") |
167 | (synopsis | |
168 | "Python bindings for the Docker credentials store API") | |
169 | (description | |
170 | "Docker-Pycreds contains the Python bindings for the docker credentials | |
171 | store API. It allows programmers to interact with a Docker registry using | |
172 | Python without keeping their credentials in a Docker configuration file.") | |
173 | (license license:asl2.0))) | |
4e5b8f72 DM |
174 | |
175 | (define-public containerd | |
176 | (package | |
177 | (name "containerd") | |
f3a16cab | 178 | (version "1.6.6") |
4e5b8f72 DM |
179 | (source |
180 | (origin | |
9b52ae19 LLB |
181 | (method git-fetch) |
182 | (uri (git-reference | |
183 | (url "https://github.com/containerd/containerd") | |
184 | (commit (string-append "v" version)))) | |
185 | (file-name (git-file-name name version)) | |
186 | (sha256 | |
b33e1a18 OP |
187 | (base32 "1vsl747i3wyy68j4lp4nprwxadbyga8qxlrk892afcd2990zp5mr")) |
188 | (patches | |
189 | (search-patches "containerd-create-pid-file.patch")))) | |
4e5b8f72 DM |
190 | (build-system go-build-system) |
191 | (arguments | |
c37d970f PL |
192 | (let ((make-flags #~(list (string-append "VERSION=" #$version) |
193 | (string-append "DESTDIR=" #$output) | |
194 | "PREFIX=" | |
195 | "REVISION=0"))) | |
196 | (list | |
197 | #:import-path "github.com/containerd/containerd" | |
198 | #:phases | |
199 | #~(modify-phases %standard-phases | |
200 | (add-after 'unpack 'patch-paths | |
201 | (lambda* (#:key inputs import-path outputs #:allow-other-keys) | |
202 | (with-directory-excursion (string-append "src/" import-path) | |
203 | (substitute* "runtime/v1/linux/runtime.go" | |
204 | (("defaultRuntime[ \t]*=.*") | |
205 | (string-append "defaultRuntime = \"" | |
206 | (search-input-file inputs "/sbin/runc") | |
207 | "\"\n")) | |
208 | (("defaultShim[ \t]*=.*") | |
209 | (string-append "defaultShim = \"" | |
210 | (assoc-ref outputs "out") | |
211 | "/bin/containerd-shim\"\n"))) | |
212 | (substitute* "pkg/cri/config/config_unix.go" | |
213 | (("DefaultRuntimeName: \"runc\"") | |
214 | (string-append "DefaultRuntimeName: \"" | |
215 | (search-input-file inputs "/sbin/runc") | |
216 | "\""))) | |
217 | (substitute* "vendor/github.com/containerd/go-runc/runc.go" | |
218 | (("DefaultCommand[ \t]*=.*") | |
219 | (string-append "DefaultCommand = \"" | |
220 | (search-input-file inputs "/sbin/runc") | |
221 | "\"\n"))) | |
222 | (substitute* "vendor/github.com/containerd/continuity/testutil\ | |
7bf82f5e | 223 | /loopback/loopback_linux.go" |
c37d970f PL |
224 | (("exec\\.Command\\(\"losetup\"") |
225 | (string-append "exec.Command(\"" | |
226 | (search-input-file inputs "/sbin/losetup") | |
227 | "\""))) | |
228 | (substitute* "archive/compression/compression.go" | |
229 | (("exec\\.LookPath\\(\"unpigz\"\\)") | |
230 | (string-append "\"" | |
231 | (search-input-file inputs "/bin/unpigz") | |
232 | "\", error(nil)")))))) | |
233 | (replace 'build | |
234 | (lambda* (#:key import-path #:allow-other-keys) | |
235 | (with-directory-excursion (string-append "src/" import-path) | |
236 | (apply invoke "make" #$make-flags)))) | |
237 | (replace 'install | |
238 | (lambda* (#:key import-path #:allow-other-keys) | |
239 | (with-directory-excursion (string-append "src/" import-path) | |
240 | (apply invoke "make" "install" #$make-flags)))))))) | |
4e5b8f72 | 241 | (inputs |
8394619b | 242 | (list btrfs-progs libseccomp pigz runc util-linux)) |
4e5b8f72 | 243 | (native-inputs |
8394619b | 244 | (list go pkg-config)) |
40c7476a | 245 | (synopsis "Docker container runtime") |
4e5b8f72 DM |
246 | (description "This package provides the container daemon for Docker. |
247 | It includes image transfer and storage, container execution and supervision, | |
248 | network attachments.") | |
dd6114df | 249 | (home-page "https://containerd.io/") |
4e5b8f72 | 250 | (license license:asl2.0))) |
f87ea24a | 251 | |
9c0244ab MC |
252 | ;;; Private package that shouldn't be used directly; its purposes is to be |
253 | ;;; used as a template for the various packages it contains. It doesn't build | |
254 | ;;; anyway, as it needs many dependencies that aren't being satisfied. | |
255 | (define docker-libnetwork | |
256 | ;; There are no recent release for libnetwork, so choose the last commit of | |
185ae9b4 PL |
257 | ;; the branch that Docker uses, as can be seen in the 'vendor.conf' Docker |
258 | ;; source file. NOTE - It is important that this version is kept in sync | |
259 | ;; with the version of Docker being used. | |
260 | (let ((commit "f6ccccb1c082a432c2a5814aaedaca56af33d9ea") | |
87a13a5e | 261 | (version (version-major+minor %docker-version)) |
9c0244ab MC |
262 | (revision "1")) |
263 | (package | |
264 | (name "docker-libnetwork") | |
87a13a5e | 265 | (version (git-version version revision commit)) |
9c0244ab MC |
266 | (source (origin |
267 | (method git-fetch) | |
268 | (uri (git-reference | |
87a13a5e JD |
269 | ;; Redirected from github.com/docker/libnetwork. |
270 | (url "https://github.com/moby/libnetwork") | |
9c0244ab MC |
271 | (commit commit))) |
272 | (file-name (git-file-name name version)) | |
273 | (sha256 | |
274 | (base32 | |
185ae9b4 | 275 | "0nxpr0h0smv4n641g41vxibr5r85ixfcvs9cp3c4fc7zvrhjc49s")) |
9c0244ab MC |
276 | ;; Delete bundled ("vendored") free software source code. |
277 | (modules '((guix build utils))) | |
185ae9b4 | 278 | (snippet '(delete-file-recursively "vendor")))) |
9c0244ab MC |
279 | (build-system go-build-system) |
280 | (arguments | |
87a13a5e JD |
281 | `(#:import-path "github.com/moby/libnetwork/")) |
282 | (home-page "https://github.com/moby/libnetwork/") | |
9c0244ab MC |
283 | (synopsis "Networking for containers") |
284 | (description "Libnetwork provides a native Go implementation for | |
285 | connecting containers. The goal of @code{libnetwork} is to deliver a robust | |
286 | container network model that provides a consistent programming interface and | |
287 | the required network abstractions for applications.") | |
288 | (license license:asl2.0)))) | |
289 | ||
0b94911a MC |
290 | (define-public docker-libnetwork-cmd-proxy |
291 | (package | |
292 | (inherit docker-libnetwork) | |
293 | (name "docker-libnetwork-cmd-proxy") | |
294 | (arguments | |
295 | `(#:import-path "github.com/docker/libnetwork/cmd/proxy" | |
296 | #:unpack-path "github.com/docker/libnetwork" | |
297 | #:install-source? #f)) | |
298 | (native-inputs | |
299 | `(("go-sctp" ,go-sctp) | |
300 | ;; For tests. | |
301 | ("logrus" ,go-github-com-sirupsen-logrus) | |
302 | ("go-netlink" ,go-netlink) | |
303 | ("go-netns" ,go-netns) | |
561d391b LF |
304 | ("go-golang-org-x-crypto" |
305 | ,go-golang-org-x-crypto) | |
306 | ("go-golang-org-x-sys" ,go-golang-org-x-sys))) | |
0b94911a MC |
307 | (synopsis "Docker user-space proxy") |
308 | (description "A proxy running in the user space. It is used by the | |
309 | built-in registry server of Docker.") | |
310 | (license license:asl2.0))) | |
311 | ||
516f6f55 DM |
312 | ;; TODO: Patch out modprobes for ip_vs, nf_conntrack, |
313 | ;; brige, nf_conntrack_netlink, aufs. | |
f87ea24a DM |
314 | (define-public docker |
315 | (package | |
316 | (name "docker") | |
317 | (version %docker-version) | |
318 | (source | |
319 | (origin | |
c6279326 MC |
320 | (method git-fetch) |
321 | (uri (git-reference | |
83cda00b | 322 | (url "https://github.com/moby/moby") |
c6279326 MC |
323 | (commit (string-append "v" version)))) |
324 | (file-name (git-file-name name version)) | |
325 | (sha256 | |
185ae9b4 | 326 | (base32 "0hn7fg717rggwk6dbicrwa7aglqp7dp0jp5rvn6p9gfcnrp2w97d")))) |
f87ea24a DM |
327 | (build-system gnu-build-system) |
328 | (arguments | |
168a4955 PL |
329 | (list |
330 | #:modules | |
331 | '((guix build gnu-build-system) | |
f87ea24a | 332 | ((guix build go-build-system) #:prefix go:) |
e3900a4d | 333 | (guix build union) |
f87ea24a | 334 | (guix build utils)) |
168a4955 PL |
335 | #:imported-modules |
336 | `(,@%gnu-build-system-modules | |
e3900a4d | 337 | (guix build union) |
f87ea24a | 338 | (guix build go-build-system)) |
168a4955 PL |
339 | #:phases |
340 | #~(modify-phases %standard-phases | |
341 | (add-after 'unpack 'patch-paths | |
342 | (lambda* (#:key inputs #:allow-other-keys) | |
343 | (substitute* "builder/builder-next/executor_unix.go" | |
344 | (("CommandCandidates:.*runc.*") | |
345 | (string-append "CommandCandidates: []string{\"" | |
346 | (search-input-file inputs "/sbin/runc") | |
347 | "\"},\n"))) | |
348 | (substitute* "vendor/github.com/containerd/go-runc/runc.go" | |
349 | (("DefaultCommand = .*") | |
350 | (string-append "DefaultCommand = \"" | |
351 | (search-input-file inputs "/sbin/runc") | |
352 | "\"\n"))) | |
487070c4 MC |
353 | (substitute* "vendor/github.com/containerd/containerd/\ |
354 | runtime/v1/linux/runtime.go" | |
168a4955 PL |
355 | (("defaultRuntime[ \t]*=.*") |
356 | (string-append "defaultRuntime = \"" | |
357 | (search-input-file inputs "/sbin/runc") | |
358 | "\"\n")) | |
359 | (("defaultShim[ \t]*=.*") | |
360 | (string-append "defaultShim = \"" | |
361 | (search-input-file inputs "/bin/containerd-shim") | |
362 | "\"\n"))) | |
363 | (substitute* "daemon/daemon_unix.go" | |
364 | (("DefaultShimBinary = .*") | |
365 | (string-append "DefaultShimBinary = \"" | |
366 | (search-input-file inputs "/bin/containerd-shim") | |
367 | "\"\n")) | |
368 | (("DefaultRuntimeBinary = .*") | |
369 | (string-append "DefaultRuntimeBinary = \"" | |
370 | (search-input-file inputs "/sbin/runc") | |
371 | "\"\n"))) | |
372 | (substitute* "daemon/runtime_unix.go" | |
373 | (("defaultRuntimeName = .*") | |
374 | (string-append "defaultRuntimeName = \"" | |
375 | (search-input-file inputs "/sbin/runc") | |
376 | "\"\n"))) | |
377 | (substitute* "daemon/config/config.go" | |
378 | (("StockRuntimeName = .*") | |
379 | (string-append "StockRuntimeName = \"" | |
380 | (search-input-file inputs "/sbin/runc") | |
381 | "\"\n")) | |
382 | (("DefaultInitBinary = .*") | |
383 | (string-append "DefaultInitBinary = \"" | |
384 | (search-input-file inputs "/bin/tini-static") | |
385 | "\"\n"))) | |
386 | (substitute* "daemon/config/config_common_unix_test.go" | |
387 | (("expectedInitPath: \"docker-init\"") | |
388 | (string-append "expectedInitPath: \"" | |
389 | (search-input-file inputs "/bin/tini-static") | |
390 | "\""))) | |
487070c4 MC |
391 | (substitute* "vendor/github.com/moby/buildkit/executor/\ |
392 | runcexecutor/executor.go" | |
168a4955 PL |
393 | (("var defaultCommandCandidates = .*") |
394 | (string-append "var defaultCommandCandidates = []string{\"" | |
395 | (search-input-file inputs "/sbin/runc") "\"}"))) | |
396 | (substitute* "vendor/github.com/docker/libnetwork/portmapper/proxy.go" | |
397 | (("var userlandProxyCommandName = .*") | |
398 | (string-append "var userlandProxyCommandName = \"" | |
399 | (search-input-file inputs "/bin/proxy") | |
400 | "\"\n"))) | |
401 | (substitute* "pkg/archive/archive.go" | |
402 | (("string\\{\"xz") | |
403 | (string-append "string{\"" (search-input-file inputs "/bin/xz")))) | |
6e9f8826 | 404 | |
168a4955 PL |
405 | (let ((source-files (filter (lambda (name) |
406 | (not (string-contains name "test"))) | |
407 | (find-files "." "\\.go$")))) | |
408 | (let-syntax ((substitute-LookPath* | |
409 | (syntax-rules () | |
410 | ((_ (source-text path) ...) | |
411 | (substitute* source-files | |
412 | (((string-append "\\<exec\\.LookPath\\(\"" | |
413 | source-text | |
414 | "\")")) | |
415 | (string-append "\"" | |
416 | (search-input-file inputs path) | |
417 | "\", error(nil)")) ...)))) | |
418 | (substitute-Command* | |
419 | (syntax-rules () | |
420 | ((_ (source-text path) ...) | |
421 | (substitute* source-files | |
422 | (((string-append "\\<(re)?exec\\.Command\\(\"" | |
423 | source-text | |
424 | "\"") _ re?) | |
425 | (string-append (if re? re? "") | |
426 | "exec.Command(\"" | |
427 | (search-input-file inputs path) | |
428 | "\"")) ...))))) | |
429 | (substitute-LookPath* | |
430 | ("containerd" "/bin/containerd") | |
431 | ("ps" "/bin/ps") | |
432 | ("mkfs.xfs" "/sbin/mkfs.xfs") | |
433 | ("lvmdiskscan" "/sbin/lvmdiskscan") | |
434 | ("pvdisplay" "/sbin/pvdisplay") | |
435 | ("blkid" "/sbin/blkid") | |
436 | ("unpigz" "/bin/unpigz") | |
437 | ("iptables" "/sbin/iptables") | |
438 | ("ip6tables" "/sbin/ip6tables") | |
439 | ("iptables-legacy" "/sbin/iptables") | |
440 | ("ip" "/sbin/ip")) | |
a01d54f3 | 441 | |
168a4955 PL |
442 | (substitute-Command* |
443 | ("modprobe" "/bin/modprobe") | |
444 | ("pvcreate" "/sbin/pvcreate") | |
445 | ("vgcreate" "/sbin/vgcreate") | |
446 | ("lvcreate" "/sbin/lvcreate") | |
447 | ("lvconvert" "/sbin/lvconvert") | |
448 | ("lvchange" "/sbin/lvchange") | |
449 | ("mkfs.xfs" "/sbin/mkfs.xfs") | |
450 | ("xfs_growfs" "/sbin/xfs_growfs") | |
451 | ("mkfs.ext4" "/sbin/mkfs.ext4") | |
452 | ("tune2fs" "/sbin/tune2fs") | |
453 | ("blkid" "/sbin/blkid") | |
454 | ("resize2fs" "/sbin/resize2fs") | |
455 | ("ps" "/bin/ps") | |
456 | ("losetup" "/sbin/losetup") | |
457 | ("uname" "/bin/uname") | |
458 | ("dbus-launch" "/bin/dbus-launch") | |
459 | ("git" "/bin/git"))) | |
460 | ;; docker-mountfrom ?? | |
461 | ;; docker | |
462 | ;; docker-untar ?? | |
463 | ;; docker-applyLayer ?? | |
464 | ;; /usr/bin/uname | |
465 | ;; grep | |
466 | ;; apparmor_parser | |
a01d54f3 | 467 | |
168a4955 PL |
468 | ;; Make compilation fail when, in future versions, Docker |
469 | ;; invokes other programs we don't know about and thus don't | |
470 | ;; substitute. | |
471 | (substitute* source-files | |
472 | ;; Search for Java in PATH. | |
473 | (("\\<exec\\.Command\\(\"java\"") | |
474 | "xxec.Command(\"java\"") | |
475 | ;; Search for AUFS in PATH (mainline Linux doesn't support it). | |
476 | (("\\<exec\\.Command\\(\"auplink\"") | |
477 | "xxec.Command(\"auplink\"") | |
478 | ;; Fail on other unsubstituted commands. | |
479 | (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\"" | |
480 | _ executable) | |
481 | (string-append "exec.Guix_doesnt_want_Command(\"" | |
482 | executable "\"")) | |
483 | (("\\<xxec\\.Command") | |
484 | "exec.Command") | |
485 | ;; Search for ZFS in PATH. | |
486 | (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")") | |
185ae9b4 PL |
487 | ;; Do not fail when buildkit-qemu-<target> isn't found. |
488 | ;; FIXME: We might need to package buildkit and docker's | |
489 | ;; buildx plugin, to support qemu-based docker containers. | |
168a4955 PL |
490 | (("\\<LookPath\\(\"buildkit-qemu-\"") "LooxPath(\"buildkit-qemu-\"") |
491 | ;; Fail on other unsubstituted LookPaths. | |
492 | (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"") | |
493 | (("\\<LooxPath") "LookPath"))))) | |
494 | (add-after 'patch-paths 'delete-failing-tests | |
495 | (lambda _ | |
496 | ;; Needs internet access. | |
497 | (delete-file "builder/remotecontext/git/gitutils_test.go") | |
498 | ;; Permission denied. | |
499 | (delete-file "daemon/graphdriver/devmapper/devmapper_test.go") | |
500 | ;; Operation not permitted (idtools.MkdirAllAndChown). | |
501 | (delete-file "daemon/graphdriver/vfs/vfs_test.go") | |
502 | ;; Timeouts after 5 min. | |
503 | (delete-file "plugin/manager_linux_test.go") | |
504 | ;; Operation not permitted. | |
505 | (delete-file "daemon/graphdriver/aufs/aufs_test.go") | |
506 | (delete-file "daemon/graphdriver/btrfs/btrfs_test.go") | |
507 | (delete-file "daemon/graphdriver/overlay/overlay_test.go") | |
508 | (delete-file "daemon/graphdriver/overlay2/overlay_test.go") | |
509 | (delete-file "pkg/chrootarchive/archive_unix_test.go") | |
510 | (delete-file "daemon/container_unix_test.go") | |
511 | ;; This file uses cgroups and /proc. | |
512 | (delete-file "pkg/sysinfo/sysinfo_linux_test.go") | |
513 | ;; This file uses cgroups. | |
514 | (delete-file "runconfig/config_test.go") | |
515 | ;; This file uses /var. | |
516 | (delete-file "daemon/oci_linux_test.go") | |
517 | ;; Signal tests fail in bizarre ways | |
518 | (delete-file "pkg/signal/signal_linux_test.go"))) | |
519 | (replace 'configure | |
520 | (lambda _ | |
521 | (setenv "DOCKER_BUILDTAGS" "seccomp") | |
522 | (setenv "DOCKER_GITCOMMIT" (string-append "v" #$%docker-version)) | |
523 | (setenv "VERSION" (string-append #$%docker-version "-ce")) | |
524 | ;; Automatically use bundled dependencies. | |
525 | ;; TODO: Unbundle - see file "vendor.conf". | |
526 | (setenv "AUTO_GOPATH" "1") | |
527 | ;; Respectively, strip the symbol table and debug | |
528 | ;; information, and the DWARF symbol table. | |
529 | (setenv "LDFLAGS" "-s -w") | |
530 | ;; Make build faster | |
531 | (setenv "GOCACHE" "/tmp"))) | |
532 | (add-before 'build 'setup-go-environment | |
533 | (assoc-ref go:%standard-phases 'setup-go-environment)) | |
534 | (replace 'build | |
535 | (lambda _ | |
536 | ;; Our LD doesn't like the statically linked relocatable things | |
537 | ;; that go produces, so install the dynamic version of | |
538 | ;; dockerd instead. | |
539 | (invoke "hack/make.sh" "dynbinary"))) | |
540 | (replace 'check | |
487070c4 MC |
541 | (lambda* (#:key tests? #:allow-other-keys) |
542 | (when tests? | |
543 | ;; The build process generated a file because the environment | |
544 | ;; variable "AUTO_GOPATH" was set. Use it. | |
545 | (setenv "GOPATH" (string-append (getcwd) "/.gopath")) | |
546 | ;; ".gopath/src/github.com/docker/docker" is a link to the current | |
547 | ;; directory and chdir would canonicalize to that. | |
548 | ;; But go needs to have the uncanonicalized directory name, so | |
549 | ;; store that. | |
550 | (setenv "PWD" (string-append | |
551 | (getcwd) "/.gopath/src/github.com/docker/docker")) | |
552 | (with-directory-excursion ".gopath/src/github.com/docker/docker" | |
553 | (invoke "hack/test/unit")) | |
554 | (setenv "PWD" #f)))) | |
168a4955 PL |
555 | (replace 'install |
556 | (lambda* (#:key outputs #:allow-other-keys) | |
557 | (let* ((out (assoc-ref outputs "out")) | |
558 | (out-bin (string-append out "/bin"))) | |
559 | (install-file "bundles/dynbinary-daemon/dockerd" out-bin) | |
560 | (install-file (string-append "bundles/dynbinary-daemon/dockerd-" | |
561 | (getenv "VERSION")) | |
562 | out-bin)))) | |
563 | (add-after 'install 'remove-go-references | |
564 | (assoc-ref go:%standard-phases 'remove-go-references))))) | |
f87ea24a | 565 | (inputs |
168a4955 PL |
566 | (list btrfs-progs |
567 | containerd ; for containerd-shim | |
568 | coreutils | |
569 | dbus | |
570 | docker-libnetwork-cmd-proxy | |
571 | e2fsprogs | |
572 | git | |
573 | iproute | |
574 | iptables | |
575 | kmod | |
576 | libseccomp | |
577 | pigz | |
578 | procps | |
579 | runc | |
580 | util-linux | |
581 | lvm2 | |
582 | tini | |
7e0ad0dd | 583 | xfsprogs-5.9 |
168a4955 | 584 | xz)) |
f87ea24a | 585 | (native-inputs |
8394619b | 586 | (list eudev ; TODO: Should be propagated by lvm2 (.pc -> .pc) |
185ae9b4 | 587 | go gotestsum pkg-config)) |
487070c4 | 588 | (synopsis "Container component library and daemon") |
f87ea24a DM |
589 | (description "This package provides a framework to assemble specialized |
590 | container systems. It includes components for orchestration, image | |
591 | management, secret management, configuration management, networking, | |
592 | provisioning etc.") | |
593 | (home-page "https://mobyproject.org/") | |
594 | (license license:asl2.0))) | |
e9b31645 DM |
595 | |
596 | (define-public docker-cli | |
597 | (package | |
598 | (name "docker-cli") | |
599 | (version %docker-version) | |
600 | (source | |
601 | (origin | |
185ae9b4 PL |
602 | (method git-fetch) |
603 | (uri (git-reference | |
604 | (url "https://github.com/docker/cli") | |
605 | (commit (string-append "v" version)))) | |
606 | (file-name (git-file-name name version)) | |
607 | (sha256 | |
608 | (base32 "0ksicj4iqvgp9jabd4xmhkf3vax6dwn4f5dsr73bdqj4mf3ahav0")))) | |
e9b31645 DM |
609 | (build-system go-build-system) |
610 | (arguments | |
611 | `(#:import-path "github.com/docker/cli" | |
612 | ;; TODO: Tests require a running Docker daemon. | |
613 | #:tests? #f | |
614 | #:phases | |
615 | (modify-phases %standard-phases | |
616 | (add-before 'build 'setup-environment-2 | |
617 | (lambda _ | |
618 | ;; Respectively, strip the symbol table and debug | |
619 | ;; information, and the DWARF symbol table. | |
620 | (setenv "LDFLAGS" "-s -w") | |
621 | ||
e9200377 MB |
622 | ;; Make sure "docker -v" prints a usable version string. |
623 | (setenv "VERSION" ,%docker-version) | |
624 | ||
e9b31645 DM |
625 | ;; Make build reproducible. |
626 | (setenv "BUILDTIME" "1970-01-01 00:00:01.000000000+00:00") | |
627 | (symlink "src/github.com/docker/cli/scripts" "./scripts") | |
185ae9b4 | 628 | (symlink "src/github.com/docker/cli/docker.Makefile" "./docker.Makefile"))) |
e9b31645 DM |
629 | (replace 'build |
630 | (lambda _ | |
185ae9b4 PL |
631 | (setenv "GO_LINKMODE" "dynamic") |
632 | (invoke "./scripts/build/binary"))) | |
e9b31645 DM |
633 | (replace 'check |
634 | (lambda* (#:key make-flags tests? #:allow-other-keys) | |
635 | (setenv "PATH" (string-append (getcwd) "/build:" (getenv "PATH"))) | |
185ae9b4 PL |
636 | (when tests? |
637 | ;; Use the newly-built docker client for the tests. | |
638 | (with-directory-excursion "src/github.com/docker/cli" | |
639 | ;; TODO: Run test-e2e as well? | |
640 | (apply invoke "make" "-f" "docker.Makefile" "test-unit" | |
641 | (or make-flags '())))))) | |
e9b31645 DM |
642 | (replace 'install |
643 | (lambda* (#:key outputs #:allow-other-keys) | |
644 | (let* ((out (assoc-ref outputs "out")) | |
449dc8b7 OP |
645 | (out-bin (string-append out "/bin")) |
646 | (etc (string-append out "/etc"))) | |
647 | (with-directory-excursion "src/github.com/docker/cli/contrib/completion" | |
648 | (install-file "bash/docker" | |
649 | (string-append etc "/bash_completion.d")) | |
650 | (install-file "fish/docker.fish" | |
651 | (string-append etc "/fish/completions")) | |
652 | (install-file "zsh/_docker" | |
653 | (string-append etc "/zsh/site-functions"))) | |
185ae9b4 | 654 | (install-file "build/docker" out-bin))))))) |
e9b31645 | 655 | (native-inputs |
8394619b | 656 | (list go libltdl pkg-config)) |
e9b31645 DM |
657 | (synopsis "Command line interface to Docker") |
658 | (description "This package provides a command line interface to Docker.") | |
17d25019 | 659 | (home-page "https://www.docker.com/") |
e9b31645 | 660 | (license license:asl2.0))) |
975a953b MC |
661 | |
662 | (define-public cqfd | |
663 | (package | |
664 | (name "cqfd") | |
c233b7b4 | 665 | (version "5.3.0") |
975a953b MC |
666 | (source (origin |
667 | (method git-fetch) | |
668 | (uri (git-reference | |
b0e7b699 | 669 | (url "https://github.com/savoirfairelinux/cqfd") |
975a953b MC |
670 | (commit (string-append "v" version)))) |
671 | (file-name (git-file-name name version)) | |
672 | (sha256 | |
673 | (base32 | |
c233b7b4 | 674 | "0gy4kjy6v52acfk6ffbg5sp02k6176khhkms7zlwmywq8591bpww")))) |
975a953b MC |
675 | (build-system gnu-build-system) |
676 | (arguments | |
677 | ;; The test suite requires a docker daemon and connectivity. | |
678 | `(#:tests? #f | |
679 | #:phases | |
680 | (modify-phases %standard-phases | |
681 | (delete 'configure) | |
682 | (delete 'build) | |
683 | (replace 'install | |
684 | (lambda* (#:key outputs #:allow-other-keys) | |
685 | (let ((out (assoc-ref outputs "out"))) | |
686 | ;; Fix the directory of the bash completion. | |
687 | (substitute* "Makefile" | |
688 | (("completionsdir=.*$") | |
689 | (string-append "completionsdir=" out | |
690 | "/etc/bash_completion.d; \\\n"))) | |
691 | (invoke "make" "install" | |
692 | (string-append "PREFIX=" out)))))))) | |
693 | (home-page "https://github.com/savoirfairelinux/cqfd") | |
694 | (synopsis "Convenience wrapper for Docker") | |
695 | (description "cqfd is a Bash script that provides a quick and convenient | |
112fd34f | 696 | way to run commands in the current directory, but within a Docker container |
975a953b MC |
697 | defined in a per-project configuration file.") |
698 | (license license:gpl3+))) | |
92086eed MC |
699 | |
700 | (define-public tini | |
701 | (package | |
702 | (name "tini") | |
352f23f7 | 703 | (version "0.19.0") |
92086eed MC |
704 | (source (origin |
705 | (method git-fetch) | |
706 | (uri (git-reference | |
b0e7b699 | 707 | (url "https://github.com/krallin/tini") |
92086eed MC |
708 | (commit (string-append "v" version)))) |
709 | (file-name (git-file-name name version)) | |
710 | (sha256 | |
711 | (base32 | |
352f23f7 | 712 | "1hnnvjydg7gi5gx6nibjjdnfipblh84qcpajc08nvr44rkzswck4")))) |
92086eed MC |
713 | (build-system cmake-build-system) |
714 | (arguments | |
715 | `(#:tests? #f ;tests require a Docker daemon | |
352f23f7 MC |
716 | ;; 'tini-static' is a static binary, which leads CMake to fail with |
717 | ;; ‘file RPATH_CHANGE could not write new RPATH: ...’. Clear | |
718 | ;; CMAKE_INSTALL_RPATH to avoid that problem. | |
719 | #:configure-flags '("-DCMAKE_INSTALL_RPATH="))) | |
92086eed MC |
720 | (home-page "https://github.com/krallin/tini") |
721 | (synopsis "Tiny but valid init for containers") | |
722 | (description "Tini is an init program specifically designed for use with | |
723 | containers. It manages a single child process and ensures that any zombie | |
724 | processes produced from it are reaped and that signals are properly forwarded. | |
725 | Tini is integrated with Docker.") | |
726 | (license license:expat))) |