diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index 95220d0bc08b0e3dffef812e2b2931aa98953982..e9114940586c04453363b3ca39ab9f6030ccce18 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -36,7 +36,9 @@ (define (call-with-clean-exit thunk)
   "Apply THUNK, but exit with a status code of 1 if it fails."
   (dynamic-wind
     (const #t)
-    thunk
+    (lambda ()
+      (thunk)
+      (primitive-exit 0))
     (lambda ()
       (primitive-exit 1))))
 
diff --git a/tests/containers.scm b/tests/containers.scm
index 4783f8e8a567bf866f1ca4564ea66ba94a0e4fa7..0ba81491baae16a3f8ce1e5363d128dcf72591d7 100644
--- a/tests/containers.scm
+++ b/tests/containers.scm
@@ -34,6 +34,10 @@ (define (assert-exit x)
 
 (test-begin "containers")
 
+(test-assert "call-with-container, exit with 0 when there is no error"
+  (zero?
+   (call-with-container '() (const #t) #:namespaces '(user))))
+
 (test-assert "call-with-container, user namespace"
   (zero?
    (call-with-container '()