Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury Bubnov committed Jan 9, 2018
1 parent 95bbecc commit 4095bbb
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import org.zeroturnaround.exec.stream.slf4j.Slf4jStream;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -397,6 +400,7 @@ default void validateFileList(List<File> composeFiles) {
class ContainerisedDockerCompose extends GenericContainer<ContainerisedDockerCompose> implements DockerCompose {

private static final String DOCKER_SOCKET_PATH = "/var/run/docker.sock";
private static final String DOCKER_CONFIG_PATH = "/root/.docker";
public static final char UNIX_PATH_SEPERATOR = ':';

public ContainerisedDockerCompose(List<File> composeFiles, String identifier) {
Expand Down Expand Up @@ -429,6 +433,11 @@ public ContainerisedDockerCompose(List<File> composeFiles, String identifier) {
addEnv("DOCKER_HOST", "unix:///docker.sock");
setStartupCheckStrategy(new IndefiniteWaitOneShotStartupCheckStrategy());
setWorkingDirectory(containerPwd);
Path dockerConfig = Paths.get(System.getProperty("user.home"), ".docker");
if (Files.exists(dockerConfig)){
addFileSystemBind(dockerConfig.toString(), DOCKER_CONFIG_PATH, READ_ONLY);
}

}

private String getDockerSocketHostPath() {
Expand Down

0 comments on commit 4095bbb

Please sign in to comment.