private void connectToPortForwardingNetwork(String networkMode) {
        PortForwardingContainer.INSTANCE
            .getNetwork()
            .map(ContainerNetwork::getNetworkID)
            .ifPresent(networkId -> {
                if (!Arrays.asList(networkId, "none", "host").contains(networkMode)) {
                    com.github.dockerjava.api.model.Network network =
                        this.dockerClient.inspectNetworkCmd().withNetworkId(networkId).exec();
                    if (!network.getContainers().containsKey(this.containerId)) {
                        this.dockerClient.connectToNetworkCmd()
                            .withContainerId(this.containerId)
                            .withNetworkId(networkId)
                            .exec();
                    }
                }
            });
    }
Set any custom settings for the create command such as shared memory size.
core/src/main/java/org/testcontainers/containers/GenericContainer.java