feat: add shm_size support in Compose and --shm-size flag for 'uc run' (closes #267)

This commit is contained in:
Pasha Sviderski
2026-03-12 22:09:28 +10:00
parent 6cc3a05ed2
commit 8ae38cfd57
9 changed files with 28 additions and 7 deletions
+2
View File
@@ -21,6 +21,8 @@ type ContainerResources struct {
Devices []DeviceMapping
// DeviceReservations requests for access to things like GPUs.
DeviceReservations []container.DeviceRequest
// SharedMemory is the size of the shared memory (in bytes) mounted at /dev/shm in the container.
SharedMemory int64
// Ulimits defines the resource limits for the container.
Ulimits map[string]Ulimit
}
+1
View File
@@ -177,6 +177,7 @@ func resourcesFromCompose(service types.ServiceConfig) api.ContainerResources {
CPU: int64(service.CPUS * 1e9),
Memory: int64(service.MemLimit),
MemoryReservation: int64(service.MemReservation),
SharedMemory: int64(service.ShmSize),
Ulimits: ulimitsFromCompose(service.Ulimits),
}
+1
View File
@@ -133,6 +133,7 @@ func TestServiceSpecFromCompose(t *testing.T) {
CPU: 0.5 * api.Core,
Memory: 100 * units.MiB,
MemoryReservation: 50 * units.MiB,
SharedMemory: 256 * units.MiB,
Ulimits: map[string]api.Ulimit{
"nofile": {Soft: 20000, Hard: 40000},
"nproc": {Soft: 65535, Hard: 65535},
+1
View File
@@ -34,6 +34,7 @@ services:
max-file: 3
mem_limit: 100M
mem_reservation: 50M
shm_size: 268435456
privileged: true
pull_policy: always
scale: 3