Created
November 5, 2017 16:57
-
-
Save vsuharnikov/0bff68ee832de42bb999b664ab68fa37 to your computer and use it in GitHub Desktop.
How to use a non-existent setting in Docker Spotify (sysctl example)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.collect.ImmutableMap | |
import com.spotify.docker.client.messages.HostConfig | |
import com.spotify.docker.client.shaded.com.fasterxml.jackson.annotation.JsonProperty | |
class ExtendedHostConfig(h: HostConfig) extends HostConfig { | |
@JsonProperty("Sysctls") | |
def sysctls(): ImmutableMap[String, String] = ImmutableMap.of( | |
"net.ipv4.tcp_keepalive_time", "15", | |
"net.ipv4.tcp_keepalive_intvl", "5", | |
"net.ipv4.tcp_keepalive_probes", "3" | |
) | |
override def capAdd() = h.capAdd() | |
override def blkioDeviceReadBps() = h.blkioDeviceReadBps() | |
override def publishAllPorts() = h.publishAllPorts() | |
override def oomScoreAdj() = h.oomScoreAdj() | |
override def storageOpt() = h.storageOpt() | |
override def pidsLimit() = h.pidsLimit() | |
override def devices() = h.devices() | |
override def cgroupParent() = h.cgroupParent() | |
override def blkioDeviceReadIOps() = h.blkioDeviceReadIOps() | |
override def readonlyRootfs() = h.readonlyRootfs() | |
override def cpuPeriod() = h.cpuPeriod() | |
override def extraHosts() = h.extraHosts() | |
override def restartPolicy() = h.restartPolicy() | |
override def containerIdFile() = h.containerIdFile() | |
override def nanoCpus() = h.nanoCpus() | |
override def blkioWeightDevice() = h.blkioWeightDevice() | |
override def cpuQuota() = h.cpuQuota() | |
override def memoryReservation() = h.memoryReservation() | |
override def cpusetCpus() = h.cpusetCpus() | |
override def links() = h.links() | |
override def binds() = h.binds() | |
override def volumesFrom() = h.volumesFrom() | |
override def securityOpt() = h.securityOpt() | |
override def dns() = h.dns() | |
override def toBuilder = h.toBuilder | |
override def oomKillDisable() = h.oomKillDisable() | |
override def memorySwap() = h.memorySwap() | |
override def portBindings() = h.portBindings() | |
override def blkioWeight() = h.blkioWeight() | |
override def memorySwappiness() = h.memorySwappiness() | |
override def ipcMode() = h.ipcMode() | |
override def dnsOptions() = h.dnsOptions() | |
override def privileged() = h.privileged() | |
override def shmSize() = h.shmSize() | |
override def blkioDeviceWriteBps() = h.blkioDeviceWriteBps() | |
override def memory() = h.memory() | |
override def autoRemove() = h.autoRemove() | |
override def pidMode() = h.pidMode() | |
override def dnsSearch() = h.dnsSearch() | |
override def cpusetMems() = h.cpusetMems() | |
override def ulimits() = h.ulimits() | |
override def blkioDeviceWriteIOps() = h.blkioDeviceWriteIOps() | |
override def lxcConf() = h.lxcConf() | |
override def tmpfs() = h.tmpfs() | |
override def logConfig() = h.logConfig() | |
override def networkMode() = h.networkMode() | |
override def cpuShares() = h.cpuShares() | |
override def capDrop() = h.capDrop() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val containerConfig = ContainerConfig.builder() | |
.image("…") | |
.hostConfig(new ExtendedHostConfig(hostConfig)) | |
.build() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment