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