docker.scm 33 KB

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