Java Code Examples for org.testcontainers.utility.MountableFile

The following examples show how to use org.testcontainers.utility.MountableFile. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: presto   Source File: Standard.java    License: Apache License 2.0 6 votes vote down vote up
public static void enablePrestoJavaDebugger(DockerContainer container, int debugPort)
{
    try {
        FileAttribute<Set<PosixFilePermission>> rwx = PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxrwxrwx"));
        Path script = Files.createTempFile("enable-java-debugger", ".sh", rwx);
        Files.writeString(
                script,
                format(
                        "#!/bin/bash\n" +
                                "printf '%%s\\n' '%s' >> '%s'\n",
                        "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:" + debugPort,
                        CONTAINER_PRESTO_JVM_CONFIG),
                UTF_8);
        container.withCopyFileToContainer(MountableFile.forHostPath(script), "/docker/presto-init.d/enable-java-debugger.sh");

        // expose debug port unconditionally when debug is enabled
        exposePort(container, debugPort);
    }
    catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
Example 2
Source Project: teku   Source File: BesuNode.java    License: Apache License 2.0 6 votes vote down vote up
public BesuNode(final Network network) {
  super(network, "hyperledger/besu:1.3.6", LOG);
  container
      .withExposedPorts(JSON_RPC_PORT)
      .withLogConsumer(frame -> LOG.debug(frame.getUtf8String().trim()))
      .waitingFor(new HttpWaitStrategy().forPort(JSON_RPC_PORT).forPath("/liveness"))
      .withCopyFileToContainer(
          MountableFile.forClasspathResource("besu/depositContractGenesis.json"), "/genesis.json")
      .withCommand(
          "--rpc-http-enabled",
          "--rpc-http-port",
          Integer.toString(JSON_RPC_PORT),
          "--rpc-http-cors-origins=*",
          "--host-whitelist=*",
          "--miner-enabled",
          "--miner-coinbase",
          "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
          "--genesis-file",
          "/genesis.json");
}
 
Example 3
Source Project: liiklus   Source File: PulsarTlsContainer.java    License: MIT License 6 votes vote down vote up
public PulsarTlsContainer(String pulsarVersion) {
    super(pulsarVersion);
    withExposedPorts(BROKER_TLS_PORT, BROKER_HTTP_PORT);
    withEnv("PULSAR_PREFIX_brokerServicePortTls", BROKER_TLS_PORT + "");
    withEnv("PULSAR_PREFIX_tlsEnabled", "true");
    withEnv("PULSAR_PREFIX_tlsCertificateFilePath", "/pulsar/broker.cert.pem");
    withEnv("PULSAR_PREFIX_tlsKeyFilePath", "/pulsar/broker.key-pk8.pem");
    withEnv("PULSAR_PREFIX_tlsTrustCertsFilePath", "/pulsar/ca.cert.pem");

    withCopyFileToContainer(MountableFile.forClasspathResource("certs/"), "/pulsar/");

    setCommand(
            "/bin/bash",
            "-c",
            "bin/apply-config-from-env.py conf/standalone.conf && " +
            "bin/apply-config-from-env.py conf/proxy.conf && " +
                    "bin/pulsar standalone --no-functions-worker -nss"
    );

    waitingFor(Wait.forLogMessage(".*Created namespace public\\/default.*", 1));
}
 
Example 4
@Bean(name = "prometheus", destroyMethod = "stop")
public GenericContainer prometheus(
    ConfigurableEnvironment environment, WaitStrategy prometheusWaitStrategy) {

  GenericContainer container =
      new GenericContainer("prom/prometheus:v2.10.0")
          .withLogConsumer(containerLogsConsumer(log))
          .withExposedPorts(PORT)
          .withCopyFileToContainer(
              MountableFile.forClasspathResource("/external/prometheus/prometheus.yml"),
              "/etc/prometheus/prometheus.yml")
          .waitingFor(prometheusWaitStrategy)
          .withStartupTimeout(Duration.ofSeconds(30));
  container.start();
  Map<String, Object> env = registerEnvironment(environment, container.getMappedPort(PORT));
  log.info("Started Prometheus server. Connection details: {}", env);
  return container;
}
 
Example 5
Source Project: testcontainers-java   Source File: Neo4jContainerTest.java    License: MIT License 6 votes vote down vote up
@Test
public void shouldCopyDatabase() {
    try (
        Neo4jContainer neo4jContainer = new Neo4jContainer()
            .withDatabase(MountableFile.forClasspathResource("/test-graph.db"));
    ) {
        neo4jContainer.start();
        try (
            Driver driver = getDriver(neo4jContainer);
            Session session = driver.session()
        ) {
            StatementResult result = session.run("MATCH (t:Thing) RETURN t");
            assertThat(result.list().stream().map(r -> r.get("t").get("name").asString()))
                .containsExactlyInAnyOrder("Thing", "Thing 2", "Thing 3", "A box");
        }
    }
}
 
Example 6
Source Project: testcontainers-java   Source File: FileOperationsTest.java    License: MIT License 6 votes vote down vote up
@Test
public void copyFileToContainerFileTest() throws Exception {
    try (
        GenericContainer alpineCopyToContainer = new GenericContainer("alpine:3.2")
            .withCommand("top")
    ) {
        alpineCopyToContainer.start();
        final MountableFile mountableFile = MountableFile.forClasspathResource("test_copy_to_container.txt");
        alpineCopyToContainer.copyFileToContainer(mountableFile, "/test.txt");

        File actualFile = new File(temporaryFolder.getRoot().getAbsolutePath() + "/test_copy_to_container.txt");
        alpineCopyToContainer.copyFileFromContainer("/test.txt", actualFile.getPath());

        File expectedFile = new File(mountableFile.getResolvedPath());
        assertTrue("Files aren't same ", FileUtils.contentEquals(expectedFile, actualFile));
    }
}
 
Example 7
Source Project: testcontainers-java   Source File: FileOperationsTest.java    License: MIT License 6 votes vote down vote up
@Test
public void copyFileToContainerFolderTest() throws Exception {
    try (
        GenericContainer alpineCopyToContainer = new GenericContainer("alpine:3.2")
            .withCommand("top")
    ) {
        alpineCopyToContainer.start();
        final MountableFile mountableFile = MountableFile.forClasspathResource("test_copy_to_container.txt");
        alpineCopyToContainer.copyFileToContainer(mountableFile, "/home/");

        File actualFile = new File(temporaryFolder.getRoot().getAbsolutePath() + "/test_copy_to_container.txt");
        alpineCopyToContainer.copyFileFromContainer("/home/test_copy_to_container.txt", actualFile.getPath());

        File expectedFile = new File(mountableFile.getResolvedPath());
        assertTrue("Files aren't same ", FileUtils.contentEquals(expectedFile, actualFile));
    }
}
 
Example 8
Source Project: testcontainers-java   Source File: FileOperationsTest.java    License: MIT License 6 votes vote down vote up
@Test
public void copyFolderToContainerFolderTest() throws Exception {
    try (
        GenericContainer alpineCopyToContainer = new GenericContainer("alpine:3.2")
            .withCommand("top")
    ) {

        alpineCopyToContainer.start();
        final MountableFile mountableFile = MountableFile.forClasspathResource("mappable-resource/");
        alpineCopyToContainer.copyFileToContainer(mountableFile, "/home/test/");

        File actualFile = new File(temporaryFolder.getRoot().getAbsolutePath() + "/test_copy_to_container.txt");
        alpineCopyToContainer.copyFileFromContainer("/home/test/test-resource.txt", actualFile.getPath());

        File expectedFile = new File(mountableFile.getResolvedPath() + "/test-resource.txt");
        assertTrue("Files aren't same ", FileUtils.contentEquals(expectedFile, actualFile));
    }
}
 
Example 9
Source Project: testcontainers-java   Source File: FileOperationsTest.java    License: MIT License 6 votes vote down vote up
@Test
public void shouldCopyFileFromContainerTest() throws IOException {
    try (
        GenericContainer alpineCopyToContainer = new GenericContainer("alpine:3.2")
            .withCommand("top")
    ) {

        alpineCopyToContainer.start();
        final MountableFile mountableFile = MountableFile.forClasspathResource("test_copy_to_container.txt");
        alpineCopyToContainer.copyFileToContainer(mountableFile, "/home/");

        File actualFile = new File(temporaryFolder.getRoot().getAbsolutePath() + "/test_copy_from_container.txt");
        alpineCopyToContainer.copyFileFromContainer("/home/test_copy_to_container.txt", actualFile.getPath());

        File expectedFile = new File(mountableFile.getResolvedPath());
        assertTrue("Files aren't same ", FileUtils.contentEquals(expectedFile, actualFile));
    }
}
 
Example 10
Source Project: testcontainers-java   Source File: CopyFileToContainerTest.java    License: MIT License 6 votes vote down vote up
@Test
public void shouldUseCopyOnlyWithReadOnlyClasspathResources() {
    String resource = "/test_copy_to_container.txt";
    GenericContainer<?> container = new GenericContainer<>()
        .withClasspathResourceMapping(resource, "/readOnly", BindMode.READ_ONLY)
        .withClasspathResourceMapping(resource, "/readOnlyNoSelinux", BindMode.READ_ONLY)

        .withClasspathResourceMapping(resource, "/readOnlyShared", BindMode.READ_ONLY, SelinuxContext.SHARED)
        .withClasspathResourceMapping(resource, "/readWrite", BindMode.READ_WRITE);

    Map<MountableFile, String> copyMap = container.getCopyToFileContainerPathMap();
    assertTrue("uses copy for read-only", copyMap.containsValue("/readOnly"));
    assertTrue("uses copy for read-only and no Selinux", copyMap.containsValue("/readOnlyNoSelinux"));

    assertFalse("uses mount for read-only with Selinux", copyMap.containsValue("/readOnlyShared"));
    assertFalse("uses mount for read-write", copyMap.containsValue("/readWrite"));
}
 
Example 11
Source Project: testcontainers-java   Source File: ReusabilityUnitTests.java    License: MIT License 6 votes vote down vote up
@Test
public void changesInFolder() throws Exception {
    Path tempDirectory = Files.createTempDirectory("reusable_test");
    MountableFile mountableFile = MountableFile.forHostPath(tempDirectory);
    assertThat(new File(mountableFile.getResolvedPath())).isDirectory();
    container.withCopyFileToContainer(mountableFile, "/foo/bar/");

    long hash1 = container.hashCopiedFiles().getValue();

    Path fileInFolder = Files.createFile(
        // Create file in the sub-folder
        Files.createDirectory(tempDirectory.resolve("sub")).resolve("test.txt")
    );
    assertThat(fileInFolder).exists();
    Files.write(fileInFolder, UUID.randomUUID().toString().getBytes());

    assertThat(container.hashCopiedFiles().getValue()).isNotEqualTo(hash1);
}
 
Example 12
Source Project: testcontainers-java   Source File: ReusabilityUnitTests.java    License: MIT License 6 votes vote down vote up
@Test
public void folderAndFile() throws Exception {
    Path tempDirectory = Files.createTempDirectory("reusable_test");
    MountableFile mountableFile = MountableFile.forHostPath(tempDirectory);
    assertThat(new File(mountableFile.getResolvedPath())).isDirectory();
    container.withCopyFileToContainer(mountableFile, "/foo/bar/");

    long hash1 = container.hashCopiedFiles().getValue();

    container.withCopyFileToContainer(
        MountableFile.forClasspathResource("test_copy_to_container.txt"),
        "/foo/baz"
    );

    assertThat(container.hashCopiedFiles().getValue()).isNotEqualTo(hash1);
}
 
Example 13
Source Project: testcontainers-java   Source File: ReusabilityUnitTests.java    License: MIT License 6 votes vote down vote up
@Test
public void folderPermissions() throws Exception {
    Path tempDirectory = Files.createTempDirectory("reusable_test");
    MountableFile mountableFile = MountableFile.forHostPath(tempDirectory);
    assertThat(new File(mountableFile.getResolvedPath())).isDirectory();
    Path subDir = Files.createDirectory(tempDirectory.resolve("sub"));
    subDir.toFile().setWritable(false);
    assumeThat(subDir.toFile().canWrite()).isFalse();
    container.withCopyFileToContainer(mountableFile, "/foo/bar/");

    long hash1 = container.hashCopiedFiles().getValue();

    subDir.toFile().setWritable(true);
    assumeThat(subDir.toFile()).canWrite();

    assertThat(container.hashCopiedFiles().getValue()).isNotEqualTo(hash1);
}
 
Example 14
Source Project: teku   Source File: Prysm.java    License: Apache License 2.0 5 votes vote down vote up
public Prysm() {
  super("gcr.io/prysmaticlabs/prysm/beacon-chain:latest");
  try {
    PrivKey privKey = KeyKt.generateKeyPair(KEY_TYPE.SECP256K1).component1();
    PubKey pubKey = privKey.publicKey();
    nodeId = new LibP2PNodeId(PeerId.fromPubKey(pubKey));

    privKeyFile = writePrivKeyToFile(privKey);

    withExposedPorts(13000);
    withCommand(
        "--p2p-tcp-port",
        "13000",
        "--no-discovery",
        "--minimal-config",
        "--p2p-priv-key",
        PRIVKEY_TARGET_PATH,
        "--verbosity",
        "INFO");
    withStartupTimeout(Duration.of(2, MINUTES));
    waitingFor(Wait.forLogMessage(".*Node started p2p server.*", 1));
    withCopyFileToContainer(
        MountableFile.forHostPath(privKeyFile.getAbsolutePath()), PRIVKEY_TARGET_PATH);
    withLogConsumer(outputFrame -> LOG.debug(outputFrame.getUtf8String().trim()));
  } catch (final IOException e) {
    throw new RuntimeException(e);
  }
}
 
Example 15
Source Project: teku   Source File: TekuNode.java    License: Apache License 2.0 5 votes vote down vote up
public void start() throws Exception {
  assertThat(started).isFalse();
  LOG.debug("Start node {}", nodeAlias);
  started = true;
  final Map<File, String> configFiles = config.write();
  this.configFiles = configFiles.keySet();
  configFiles.forEach(
      (localFile, targetPath) ->
          container.withCopyFileToContainer(
              MountableFile.forHostPath(localFile.getAbsolutePath()), targetPath));
  container.start();
}
 
Example 16
Source Project: vertx-sql-client   Source File: ContainerPgRule.java    License: Apache License 2.0 5 votes vote down vote up
private void initServer(String version) throws Exception {
  File setupFile = getTestResource("resources" + File.separator + "create-postgres.sql");
  
  server = (PostgreSQLContainer) new PostgreSQLContainer("postgres:" + version)
      .withDatabaseName("postgres")
      .withUsername("postgres")
      .withPassword("postgres")
      .withCopyFileToContainer(MountableFile.forHostPath(setupFile.toPath()), "/docker-entrypoint-initdb.d/create-postgres.sql");
  if(ssl) {
    server.withCopyFileToContainer(MountableFile.forHostPath(getTestResource("resources" +File.separator + "server.crt").toPath()), "/server.crt")
          .withCopyFileToContainer(MountableFile.forHostPath(getTestResource("resources" +File.separator + "server.key").toPath()), "/server.key")
          .withCopyFileToContainer(MountableFile.forHostPath(getTestResource("ssl.sh").toPath()), "/docker-entrypoint-initdb.d/ssl.sh");
  }
}
 
Example 17
Source Project: okapi   Source File: PostgresHandleTest.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeAll
static void beforeAll() {
  MountableFile serverKeyFile = MountableFile.forClasspathResource("server.key");
  MountableFile serverCrtFile = MountableFile.forClasspathResource("server.crt");
  POSTGRESQL_CONTAINER.copyFileToContainer(serverKeyFile, KEY_PATH);
  POSTGRESQL_CONTAINER.copyFileToContainer(serverCrtFile, CRT_PATH);
  exec("chown", "postgres.postgres", KEY_PATH, CRT_PATH);
  exec("chmod", "400", KEY_PATH, CRT_PATH);
  exec("cp", "-p", CONF_PATH, CONF_BAK_PATH);

  serverCrt = getResource("server.crt");
  OkapiLogger.get().debug(() -> config().encodePrettily());
}
 
Example 18
Source Project: testcontainers-java   Source File: Neo4jContainerTest.java    License: MIT License 5 votes vote down vote up
@Test
public void shouldCopyPlugins() {
    try (
        Neo4jContainer neo4jContainer = new Neo4jContainer()
            .withPlugins(MountableFile.forClasspathResource("/custom-plugins"));
    ) {
        neo4jContainer.start();
        try (
            Driver driver = getDriver(neo4jContainer);
            Session session = driver.session()
        ) {
            assertThatCustomPluginWasCopied(session);
        }
    }
}
 
Example 19
Source Project: testcontainers-java   Source File: Neo4jContainerTest.java    License: MIT License 5 votes vote down vote up
@Test
public void shouldCopyPlugin() {
    try (
        Neo4jContainer neo4jContainer = new Neo4jContainer()
            .withPlugins(MountableFile.forClasspathResource("/custom-plugins/hello-world.jar"));
    ) {
        neo4jContainer.start();
        try (
            Driver driver = getDriver(neo4jContainer);
            Session session = driver.session()
        ) {
            assertThatCustomPluginWasCopied(session);
        }
    }
}
 
Example 20
Source Project: testcontainers-java   Source File: JdbcDatabaseContainer.java    License: MIT License 5 votes vote down vote up
protected void optionallyMapResourceParameterAsVolume(@NotNull String paramName, @NotNull String pathNameInContainer, @NotNull String defaultResource) {
    String resourceName = parameters.getOrDefault(paramName, defaultResource);

    if (resourceName != null) {
        final MountableFile mountableFile = MountableFile.forClasspathResource(resourceName);
        withCopyFileToContainer(mountableFile, pathNameInContainer);
    }
}
 
Example 21
Source Project: testcontainers-java   Source File: RabbitMQContainer.java    License: MIT License 5 votes vote down vote up
public RabbitMQContainer withSSL(
        final MountableFile keyFile,
        final MountableFile certFile,
        final MountableFile caFile,
        final SslVerification verify,
        boolean failIfNoCert,
        int verificationDepth) {

    return withSSL(keyFile, certFile, caFile, verify, failIfNoCert)
            .withEnv("RABBITMQ_SSL_DEPTH", String.valueOf(verificationDepth));
}
 
Example 22
Source Project: testcontainers-java   Source File: RabbitMQContainer.java    License: MIT License 5 votes vote down vote up
public RabbitMQContainer withSSL(
        final MountableFile keyFile,
        final MountableFile certFile,
        final MountableFile caFile,
        final SslVerification verify,
        boolean failIfNoCert) {

    return withSSL(keyFile, certFile, caFile, verify)
            .withEnv("RABBITMQ_SSL_FAIL_IF_NO_PEER_CERT", String.valueOf(failIfNoCert));
}
 
Example 23
Source Project: testcontainers-java   Source File: RabbitMQContainer.java    License: MIT License 5 votes vote down vote up
public RabbitMQContainer withSSL(
        final MountableFile keyFile,
        final MountableFile certFile,
        final MountableFile caFile,
        final SslVerification verify) {

    return withEnv("RABBITMQ_SSL_CACERTFILE", "/etc/rabbitmq/ca_cert.pem")
            .withEnv("RABBITMQ_SSL_CERTFILE", "/etc/rabbitmq/rabbitmq_cert.pem")
            .withEnv("RABBITMQ_SSL_KEYFILE", "/etc/rabbitmq/rabbitmq_key.pem")
            .withEnv("RABBITMQ_SSL_VERIFY", verify.value)
            .withCopyFileToContainer(certFile, "/etc/rabbitmq/rabbitmq_cert.pem")
            .withCopyFileToContainer(caFile, "/etc/rabbitmq/ca_cert.pem")
            .withCopyFileToContainer(keyFile, "/etc/rabbitmq/rabbitmq_key.pem");
}
 
Example 24
Source Project: testcontainers-java   Source File: RabbitMQContainerTest.java    License: MIT License 5 votes vote down vote up
@Test
public void shouldMountConfigurationFile()
{
    try (RabbitMQContainer container = new RabbitMQContainer()) {

        container.withRabbitMQConfig(MountableFile.forClasspathResource("/rabbitmq-custom.conf"));
        container.start();

        assertThat(container.getLogs()).contains("config file(s) : /etc/rabbitmq/rabbitmq-custom.conf");
        assertThat(container.getLogs()).doesNotContain(" (not found)");
    }
}
 
Example 25
Source Project: testcontainers-java   Source File: RabbitMQContainerTest.java    License: MIT License 5 votes vote down vote up
@Test
public void shouldMountConfigurationFileErlang()
{
    try (RabbitMQContainer container = new RabbitMQContainer()) {

        container.withRabbitMQConfigErlang(MountableFile.forClasspathResource("/rabbitmq-custom.config"));
        container.start();

        assertThat(container.getLogs()).contains("config file(s) : /etc/rabbitmq/rabbitmq-custom.config");
        assertThat(container.getLogs()).doesNotContain(" (not found)");
    }
}
 
Example 26
Source Project: testcontainers-java   Source File: RabbitMQContainerTest.java    License: MIT License 5 votes vote down vote up
@Test
public void shouldMountConfigurationFileSysctl()
{
    try (RabbitMQContainer container = new RabbitMQContainer()) {

        container.withRabbitMQConfigSysctl(MountableFile.forClasspathResource("/rabbitmq-custom.conf"));
        container.start();

        assertThat(container.getLogs()).contains("config file(s) : /etc/rabbitmq/rabbitmq-custom.conf");
        assertThat(container.getLogs()).doesNotContain(" (not found)");
    }
}
 
Example 27
Source Project: testcontainers-java   Source File: GenericContainer.java    License: MIT License 5 votes vote down vote up
@VisibleForTesting
@SneakyThrows(IOException.class)
void checksumFile(File file, Checksum checksum) {
    Path path = file.toPath();
    checksum.update(MountableFile.getUnixFileMode(path));
    if (file.isDirectory()) {
        try (Stream<Path> stream = Files.walk(path)) {
            stream.filter(it -> it != path).forEach(it -> {
                checksumFile(it.toFile(), checksum);
            });
        }
    } else {
        FileUtils.checksum(file, checksum);
    }
}
 
Example 28
Source Project: testcontainers-java   Source File: GenericContainer.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void addFileSystemBind(final String hostPath, final String containerPath, final BindMode mode, final SelinuxContext selinuxContext) {

    final MountableFile mountableFile = MountableFile.forHostPath(hostPath);
    binds.add(new Bind(mountableFile.getResolvedPath(), new Volume(containerPath), mode.accessMode, selinuxContext.selContext));
}
 
Example 29
Source Project: testcontainers-java   Source File: GenericContainer.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public SELF withClasspathResourceMapping(final String resourcePath, final String containerPath, final BindMode mode, final SelinuxContext selinuxContext) {
    final MountableFile mountableFile = MountableFile.forClasspathResource(resourcePath);

    if (mode == BindMode.READ_ONLY && selinuxContext == SelinuxContext.NONE) {
        withCopyFileToContainer(mountableFile, containerPath);
    } else {
        addFileSystemBind(mountableFile.getResolvedPath(), containerPath, mode, selinuxContext);
    }

    return self();
}
 
Example 30
Source Project: testcontainers-java   Source File: DockerComposeContainer.java    License: MIT License 5 votes vote down vote up
public ContainerisedDockerCompose(List<File> composeFiles, String identifier) {

        super(TestcontainersConfiguration.getInstance().getDockerComposeContainerImage());
        addEnv(ENV_PROJECT_NAME, identifier);

        // Map the docker compose file into the container
        final File dockerComposeBaseFile = composeFiles.get(0);
        final String pwd = dockerComposeBaseFile.getAbsoluteFile().getParentFile().getAbsolutePath();
        final String containerPwd = MountableFile.forHostPath(pwd).getFilesystemPath();

        final List<String> absoluteDockerComposeFiles = composeFiles.stream()
            .map(File::getAbsolutePath)
            .map(MountableFile::forHostPath)
            .map(MountableFile::getFilesystemPath)
            .collect(toList());
        final String composeFileEnvVariableValue = Joiner.on(UNIX_PATH_SEPERATOR).join(absoluteDockerComposeFiles); // we always need the UNIX path separator
        logger().debug("Set env COMPOSE_FILE={}", composeFileEnvVariableValue);
        addEnv(ENV_COMPOSE_FILE, composeFileEnvVariableValue);
        addFileSystemBind(pwd, containerPwd, READ_ONLY);

        // Ensure that compose can access docker. Since the container is assumed to be running on the same machine
        //  as the docker daemon, just mapping the docker control socket is OK.
        // As there seems to be a problem with mapping to the /var/run directory in certain environments (e.g. CircleCI)
        //  we map the socket file outside of /var/run, as just /docker.sock
        addFileSystemBind(getDockerSocketHostPath(), "/docker.sock", READ_WRITE);
        addEnv("DOCKER_HOST", "unix:///docker.sock");
        setStartupCheckStrategy(new IndefiniteWaitOneShotStartupCheckStrategy());
        setWorkingDirectory(containerPwd);
    }