private void applyConfiguration(CreateContainerCmd createCommand) { HostConfig hostConfig = buildHostConfig(); createCommand.withHostConfig(hostConfig);
List<Bind> binds = new ArrayList<>(); binds.add(new Bind("//var/run/docker.sock", new Volume("/var/run/docker.sock"))); String ryukContainerId = client.createContainerCmd(ryukImage).withHostConfig(new HostConfig().withAutoRemove(true)).withExposedPorts(new ExposedPort(8080)).withPublishAllPorts(true).withName("testcontainers-ryuk-" + DockerClientFactory.SESSION_ID).withLabels(Collections.singletonMap(DockerClientFactory.TESTCONTAINERS_LABEL, "true")).withBinds(binds).withPrivileged(TestcontainersConfiguration.getInstance().isRyukPrivileged()).exec().getId(); client.startContainerCmd(ryukContainerId).exec(); InspectContainerResponse inspectedContainer = client.inspectContainerCmd(ryukContainerId).exec();
.withHostConfig(hostConfig) // MUST BE FIRST (some of the later setters are simply proxied to HostConfig) .withName(containerName.asString()) .withLabels(labels)
private void applyConfiguration(CreateContainerCmd createCommand) { HostConfig hostConfig = buildHostConfig(); createCommand.withHostConfig(hostConfig);
hostConfig.withBinds(binds); createContainerCmd.withHostConfig(hostConfig); final String entrypoint = entrypoint(); if (entrypoint != null && !entrypoint.isEmpty()) {
protected void createContainer(DockerClient dockerClient) throws InterruptedException { pullImage(dockerClient); CreateContainerCmd createContainerCmd = dockerClient.createContainerCmd(properties.getDockerImage()) // NOSONAR .withLabels(getAllLabels()) .withEnv(getEnvs()) .withHostConfig(buildHostConfig()); adjustCreateCommand(createContainerCmd); String containerId = createContainerCmd.exec().getId(); dockerClient.startContainerCmd(containerId).exec(); containerInfo = dockerClient.inspectContainerCmd(containerId).exec(); }
.withHostConfig(hostConfig) .withExposedPorts(port) .withEnv(env)
createContainerCmd.withHostConfig(hostConfig);