Subject: [PATCH 1/2] tests: docker-system: Remove unnecessary services from Docker image.

From: Oleg Pykhalov <[email-masked]>
Date: Fri, 6 Jun 2025 23:15:38 +0300

These services aren't needed in containers since:
- udev requires device tree access controlled by the container runtime
- urandom-seed depends on udev service

* gnu/tests/docker.scm (%test-docker-system): Remove udev-service-type,
urandom-seed-service-type.

Change-Id: I2c3f7bc54fa6b5a802c8e16cba6ffae0cd09d4cc
Signed-off-by: Oleg Pykhalov <[email-masked]>
---
 gnu/tests/docker.scm | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/gnu/tests/docker.scm b/gnu/tests/docker.scm
index 90c8d0f850..84d604f8d3 100644
--- a/gnu/tests/docker.scm
+++ b/gnu/tests/docker.scm
@@ -26,10 +26,12 @@ (define-module (gnu tests docker)
   #:use-module (gnu system image)
   #:use-module (gnu system vm)
   #:use-module (gnu services)
+  #:use-module (gnu services base)
   #:use-module (gnu services dbus)
   #:use-module (gnu services networking)
   #:use-module (gnu services docker)
   #:use-module (gnu services desktop)
+  #:use-module (gnu services shepherd)
   #:use-module (gnu packages)
   #:use-module ((gnu packages base) #:select (glibc))
   #:use-module (gnu packages guile)
@@ -340,13 +342,23 @@ (define %test-docker-system
 docker-image} inside Docker.")
    (value (with-monad %store-monad
             (>>= (lower-object
-                  (system-image (os->image
-                                 (operating-system
-                                   (inherit (simple-operating-system))
-                                   ;; Use locales for a single libc to
-                                   ;; reduce space requirements.
-                                   (locale-libcs (list glibc)))
-                                 #:type docker-image-type)))
+                  (system-image
+                   (os->image
+                    (let ((os (simple-operating-system)))
+                      (operating-system
+                        (inherit os)
+                        ;; Use locales for a single libc to
+                        ;; reduce space requirements.
+                        (locale-libcs (list glibc))
+                        (services
+                         (modify-services (operating-system-user-services os)
+                           ;; Inside a container, the device tree is often
+                           ;; limited and controlled by a container runtime.
+                           (delete udev-service-type)
+                           ;; Seeding urandom rely on devices that are not
+                           ;; available inside the container.
+                           (delete urandom-seed-service-type)))))
+                    #:type docker-image-type)))
                  run-docker-system-test)))))
 
 
-- 
2.41.0