/** * Set any custom settings for the create command such as shared memory size. */ private HostConfig buildHostConfig() { HostConfig config = new HostConfig(); if (shmSize != null) { config.withShmSize(shmSize); } if (tmpFsMapping != null) { config.withTmpFs(tmpFsMapping); } return config; }
/** * Set any custom settings for the create command such as shared memory size. */ private HostConfig buildHostConfig() { HostConfig config = new HostConfig(); if (shmSize != null) { config.withShmSize(shmSize); } if (tmpFsMapping != null) { config.withTmpFs(tmpFsMapping); } return config; }
/** * Builds {@link HostConfig} * <p> * There is normally no need to overwrite this method!<br> * If you need to overwrite this method, make sure that all ports are published (necessary for mac)! * * @return configured {@link HostConfig} */ protected HostConfig buildHostConfig() { HostConfig hostConfig = new HostConfig(); hostConfig.withPublishAllPorts(Boolean.TRUE); if (!getTmpDirectories().isEmpty() && OSUtils.isLinux()) { Map<String, String> tmpDirectories = new HashMap<>(); getTmpDirectories().forEach(directory -> tmpDirectories.put(directory, "")); hostConfig.withTmpFs(tmpDirectories); } return hostConfig; }
@SuppressWarnings("resource") private DockerRabbitMQ(Optional<String> hostNamePrefix, Optional<String> clusterIdentity, Optional<String> erlangCookie, Optional<Network> net) { this.hostNameSuffix = clusterIdentity.orElse(UUID.randomUUID().toString()); this.rabbitHostName = hostName(hostNamePrefix); this.container = new GenericContainer<>(Images.RABBITMQ) .withCreateContainerCmdModifier(cmd -> cmd.withName(this.rabbitHostName)) .withCreateContainerCmdModifier(cmd -> cmd.withHostName(this.rabbitHostName)) .withExposedPorts(DEFAULT_RABBITMQ_PORT, DEFAULT_RABBITMQ_ADMIN_PORT) .waitingFor(waitStrategy()) .withLogConsumer(frame -> LOGGER.debug(frame.getUtf8String())) .withCreateContainerCmdModifier(cmd -> cmd.getHostConfig() .withTmpFs(ImmutableMap.of("/var/lib/rabbitmq/mnesia", "rw,noexec,nosuid,size=100m"))); net.ifPresent(this.container::withNetwork); erlangCookie.ifPresent(cookie -> this.container.withEnv(RABBITMQ_ERLANG_COOKIE, cookie)); this.nodeName = DEFAULT_RABBIT_NODE_NAME_PREFIX + "@" + this.rabbitHostName; this.container.withEnv(RABBITMQ_NODENAME, this.nodeName); }
@SuppressWarnings("resource") public DockerCassandra() { client = DockerClientFactory.instance().client(); cassandraContainer = new GenericContainer<>("cassandra:3.11.3") .withCreateContainerCmdModifier(cmd -> cmd.getHostConfig().withTmpFs(ImmutableMap.of("/var/lib/cassandra", "rw,noexec,nosuid,size=200m"))) .withExposedPorts(CASSANDRA_PORT) .withLogConsumer(DockerCassandra::displayDockerLog); cassandraContainer .waitingFor(new CassandraWaitStrategy(cassandraContainer)); }
@SuppressWarnings("resource") public DockerCassandra() { client = DockerClientFactory.instance().client(); cassandraContainer = new GenericContainer<>("cassandra:3.11.3") .withCreateContainerCmdModifier(cmd -> cmd.getHostConfig().withTmpFs(ImmutableMap.of("/var/lib/cassandra", "rw,noexec,nosuid,size=200m"))) .withExposedPorts(CASSANDRA_PORT) .withLogConsumer(DockerCassandra::displayDockerLog); cassandraContainer .waitingFor(new CassandraWaitStrategy(cassandraContainer)); }