diff options
author | Oleg Pykhalov <go.wigust@gmail.com> | 2022-07-02 13:41:06 +0300 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-07-13 21:36:41 -0400 |
commit | b33e1a183f6756514e6b6a3b84054a232dbddad4 (patch) | |
tree | 61fbe608e29d1fae7491a268906327e2fdd4dac0 /gnu/packages | |
parent | 5f8adea86cac1e0b126b181a4d3cc67c0503f43b (diff) |
services: docker: Fix race condition.
Fixes <https://issues.guix.gnu.org/38432>.
* gnu/packages/patches/containerd-create-pid-file.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add this.
* gnu/packages/docker.scm (containerd)[source]: Add this patch.
* gnu/services/docker.scm
(containerd-shepherd-service): Add #:pid-file and #:pid-file-timeout.
* gnu/services/docker.scm (docker-shepherd-service): Add --containerd flag.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Diffstat (limited to 'gnu/packages')
-rw-r--r-- | gnu/packages/docker.scm | 6 | ||||
-rw-r--r-- | gnu/packages/patches/containerd-create-pid-file.patch | 31 |
2 files changed, 35 insertions, 2 deletions
diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm index ae4ee419af..184280b38f 100644 --- a/gnu/packages/docker.scm +++ b/gnu/packages/docker.scm @@ -6,7 +6,7 @@ ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de> ;;; Copyright © 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com> ;;; Copyright © 2020 Jesse Dowell <jessedowell@gmail.com> -;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com> +;;; Copyright © 2021, 2022 Oleg Pykhalov <go.wigust@gmail.com> ;;; Copyright © 2022 Pierre Langlois <pierre.langlois@gmx.com> ;;; ;;; This file is part of GNU Guix. @@ -184,7 +184,9 @@ Python without keeping their credentials in a Docker configuration file.") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "1vsl747i3wyy68j4lp4nprwxadbyga8qxlrk892afcd2990zp5mr")))) + (base32 "1vsl747i3wyy68j4lp4nprwxadbyga8qxlrk892afcd2990zp5mr")) + (patches + (search-patches "containerd-create-pid-file.patch")))) (build-system go-build-system) (arguments (let ((make-flags #~(list (string-append "VERSION=" #$version) diff --git a/gnu/packages/patches/containerd-create-pid-file.patch b/gnu/packages/patches/containerd-create-pid-file.patch new file mode 100644 index 0000000000..668ffcd9e9 --- /dev/null +++ b/gnu/packages/patches/containerd-create-pid-file.patch @@ -0,0 +1,31 @@ +Copyright © 2022 Oleg Pykhalov <go.wigust@gmail.com> + +Create a PID file after containerd is ready to serve requests. + +Fixes <https://issues.guix.gnu.org/38432>. + +--- a/cmd/containerd/command/notify_linux.go 1970-01-01 03:00:01.000000000 +0300 ++++ b/cmd/containerd/command/notify_linux.go 2022-07-02 04:42:35.553753495 +0300 +@@ -22,15 +22,22 @@ + sd "github.com/coreos/go-systemd/v22/daemon" + + "github.com/containerd/containerd/log" ++ ++ "os" ++ "strconv" + ) + + // notifyReady notifies systemd that the daemon is ready to serve requests + func notifyReady(ctx context.Context) error { ++ pidFile, _ := os.Create("/run/containerd/containerd.pid") ++ defer pidFile.Close() ++ pidFile.WriteString(strconv.FormatInt(int64(os.Getpid()), 10)) + return sdNotify(ctx, sd.SdNotifyReady) + } + + // notifyStopping notifies systemd that the daemon is about to be stopped + func notifyStopping(ctx context.Context) error { ++ os.Remove("/run/containerd/containerd.pid") + return sdNotify(ctx, sd.SdNotifyStopping) + } + |