/** * Size of /dev/shm * @param bytes The number of megabytes to assign the shared memory. If null, it will apply the Docker default which is 64 MB. * @return this */ public SELF withSharedMemorySize(Long bytes) { this.shmSize = bytes; return self(); }
@Override public SELF withNetworkMode(String networkMode) { this.networkMode = networkMode; return self(); }
/** * {@inheritDoc} */ @Override public SELF withStartupCheckStrategy(StartupCheckStrategy strategy) { this.startupCheckStrategy = strategy; return self(); }
@Override public SELF withPrivilegedMode(boolean mode) { this.privilegedMode = mode; return self(); }
/** * First class support for configuring tmpfs * @param mapping path and params of tmpfs/mount flag for container * @return this */ public SELF withTmpFs(Map<String, String> mapping) { this.tmpFsMapping = mapping; return self(); }
@Override public SELF withNetworkAliases(String... aliases) { Collections.addAll(this.networkAliases, aliases); return self(); }
/** * {@inheritDoc} */ @Override public SELF withLogConsumer(Consumer<OutputFrame> consumer) { this.logConsumers.add(consumer); return self(); }
/** * Allow low level modifications of {@link CreateContainerCmd} after it was pre-configured in {@link #tryStart()}. * Invocation happens eagerly on a moment when container is created. * Warning: this does expose the underlying docker-java API so might change outside of our control. * * @param modifier {@link Consumer} of {@link CreateContainerCmd}. * @return this */ public SELF withCreateContainerCmdModifier(Consumer<CreateContainerCmd> modifier) { createContainerCmdModifiers.add(modifier); return self(); }
/** * {@inheritDoc} */ @Override public SELF withEnv(Map<String, String> env) { env.forEach(this::addEnv); return self(); }
/** * {@inheritDoc} */ @Override public SELF withLabels(Map<String, String> labels) { labels.forEach(this::withLabel); return self(); }
/** * {@inheritDoc} */ @Override public SELF withCopyFileToContainer(MountableFile mountableFile, String containerPath) { copyToFileContainerPathMap.put(mountableFile, containerPath); return self(); }
/** * {@inheritDoc} */ @Override public SELF withLabel(String key, String value) { if (key.startsWith("org.testcontainers")) { throw new IllegalArgumentException("The org.testcontainers namespace is reserved for interal use"); } labels.put(key, value); return self(); }
/** * {@inheritDoc} */ @Override public SELF withWorkingDirectory(String workDir) { this.setWorkingDirectory(workDir); return self(); }
/** * {@inheritDoc} */ @Override public SELF withFileSystemBind(String hostPath, String containerPath, BindMode mode) { addFileSystemBind(hostPath, containerPath, mode); return self(); }
/** * {@inheritDoc} */ @Override public SELF withCommand(String cmd) { this.setCommand(cmd); return self(); }
/** * {@inheritDoc} */ @Override public SELF withMinimumRunningDuration(Duration minimumRunningDuration) { this.startupCheckStrategy = new MinimumDurationRunningStartupCheckStrategy(minimumRunningDuration); return self(); }
/** * {@inheritDoc} */ @Override public SELF withExposedPorts(Integer... ports) { this.setExposedPorts(newArrayList(ports)); return self(); }
/** * {@inheritDoc} */ @Override public SELF withCommand(String... commandParts) { this.setCommand(commandParts); return self(); }
/** * {@inheritDoc} */ @Override public SELF withStartupTimeout(Duration startupTimeout) { getWaitStrategy().withStartupTimeout(startupTimeout); return self(); }
/** * {@inheritDoc} */ @Override public SELF withClasspathResourceMapping(final String resourcePath, final String containerPath, final BindMode mode, final SelinuxContext selinuxContext) { final MountableFile mountableFile = MountableFile.forClasspathResource(resourcePath); this.addFileSystemBind(mountableFile.getResolvedPath(), containerPath, mode, selinuxContext); return self(); }