testcontainers-go
testcontainers-go copied to clipboard
Allow to set Shared Memory size (shmSize) for ContainerRequest
Would it be possible to add the option to specify shmSize when defining a testcontainers.ContainerRequest?
This is especially useful for when starting docker images with some active prerequisites (in my case solace/solace-pubsub-standard.
Hey, sorry for the radio silence. :/ since https://github.com/testcontainers/testcontainers-go/pull/402, we are supporting configuring the host resources, which are mapped to https://github.com/moby/moby/blob/7b9275c0da707b030e62c96b679a976f31f929d3/api/types/container/host_config.go#L341
Is this what you are looking for?
Hi @chambodn I think this issue can be closed, as since https://github.com/testcontainers/testcontainers-go/pull/461 it's possible to set the shmSize of a container.
On the other hand, it would be great that, instead of setting the shmSize attribute, we define a consistent manner of building a HostConfig struct. We currently do this, building it from several sources:
hostConfig := &container.HostConfig{
ExtraHosts: req.ExtraHosts,
PortBindings: exposedPortMap,
Binds: req.Binds,
Mounts: mounts,
Tmpfs: req.Tmpfs,
AutoRemove: req.AutoRemove,
Privileged: req.Privileged,
NetworkMode: req.NetworkMode,
Resources: req.Resources,
ShmSize: req.ShmSize,
}
wdyt? Would you be interested in participating in the refactor?
Closing, as shmSize can be added since the already released v0.14.0.
About https://github.com/testcontainers/testcontainers-go/issues/228#issuecomment-1248337770, we can open a new issue for that if needed.
Thanks!