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