Skip to content

Commit

Permalink
feat(docker): add shmSize option
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Nov 9, 2023
1 parent 9f5c949 commit 58de46d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ public class DockerOptions {
@PluginProperty(dynamic = false)
protected Memory memory;

@Schema(
title = "Size of `/dev/shm` in bytes.",
description = "The size must be greater than 0. If omitted the system uses 64MB."
)
@PluginProperty(dynamic = true)
private String shmSize;

@Introspected
@Schema(
title = "The PullPolicy for a container and the tag of the image affect when docker attempts to pull (download) the specified image."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,30 +285,30 @@ private CreateContainerCmd configure(CommandsWrapper commands, DockerClient dock
}

if (dockerOptions.getMemory().getMemorySwap() != null) {
hostConfig.withMemorySwap(convertBytes(runContext.render(dockerOptions.getMemory()
.getMemorySwap())));
hostConfig.withMemorySwap(convertBytes(runContext.render(dockerOptions.getMemory().getMemorySwap())));
}

if (dockerOptions.getMemory().getMemorySwappiness() != null) {
hostConfig.withMemorySwappiness(convertBytes(runContext.render(dockerOptions.getMemory()
.getMemorySwappiness())));
hostConfig.withMemorySwappiness(convertBytes(runContext.render(dockerOptions.getMemory().getMemorySwappiness())));
}

if (dockerOptions.getMemory().getMemoryReservation() != null) {
hostConfig.withMemoryReservation(convertBytes(runContext.render(dockerOptions.getMemory()
.getMemoryReservation())));
hostConfig.withMemoryReservation(convertBytes(runContext.render(dockerOptions.getMemory().getMemoryReservation())));
}

if (dockerOptions.getMemory().getKernelMemory() != null) {
hostConfig.withKernelMemory(convertBytes(runContext.render(dockerOptions.getMemory()
.getKernelMemory())));
hostConfig.withKernelMemory(convertBytes(runContext.render(dockerOptions.getMemory().getKernelMemory())));
}

if (dockerOptions.getMemory().getOomKillDisable() != null) {
hostConfig.withOomKillDisable(dockerOptions.getMemory().getOomKillDisable());
}
}

if (dockerOptions.getShmSize() != null) {
hostConfig.withShmSize(convertBytes(runContext.render(dockerOptions.getShmSize())));
}

if (dockerOptions.getNetworkMode() != null) {
hostConfig.withNetworkMode(runContext.render(dockerOptions.getNetworkMode(), additionalVars));
}
Expand Down

0 comments on commit 58de46d

Please sign in to comment.