Skip to content

Commit

Permalink
fix for #536
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury Bubnov authored and rnorth committed Jan 28, 2018
1 parent d7551de commit f602d82
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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.AbstractMap.SimpleEntry;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -359,6 +362,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 @@ -391,6 +395,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 f602d82

Please sign in to comment.