Skip to content

Commit

Permalink
Merge pull request #189 from qoomon/bugfix/docker-compose-for-relativ…
Browse files Browse the repository at this point in the history
…e-paths

fix: use pwd as mounting point for docker compose
  • Loading branch information
rnorth committed Aug 1, 2016
2 parents d57740f + 5473264 commit b815501
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,17 @@ public DockerCompose(File composeFile, String identifier) {
super("docker/compose:1.8.0");
addEnv("COMPOSE_PROJECT_NAME", identifier);
// Map the docker compose file into the container
addEnv("COMPOSE_FILE", "/compose/" + composeFile.getAbsoluteFile().getName());
addFileSystemBind(composeFile.getAbsoluteFile().getParentFile().getAbsolutePath(), "/compose", READ_ONLY);
String pwd = composeFile.getAbsoluteFile().getParentFile().getAbsolutePath();
addEnv("COMPOSE_FILE", pwd + "/" + composeFile.getAbsoluteFile().getName());
addFileSystemBind(pwd, pwd, 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("/var/run/docker.sock", "/docker.sock", READ_WRITE);
addEnv("DOCKER_HOST", "unix:///docker.sock");
setStartupCheckStrategy(new IndefiniteWaitOneShotStartupCheckStrategy());
setWorkingDirectory("/compose");
setWorkingDirectory(pwd);
}

@Override
Expand Down

0 comments on commit b815501

Please sign in to comment.