testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

Allow to set Shared Memory size (shmSize) for ContainerRequest

Open chambodn opened this issue 5 years ago • 2 comments

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.

chambodn avatar Jul 10 '20 16:07 chambodn

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?

mdelapenya avatar May 19 '22 07:05 mdelapenya

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?

mdelapenya avatar Sep 15 '22 16:09 mdelapenya

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!

mdelapenya avatar Oct 20 '22 05:10 mdelapenya