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