Skip to content

Commit

Permalink
Merge pull request #87 from stevekuznetsov/skuznets/mount-shared
Browse files Browse the repository at this point in the history
Label the Docker workspace volume mount shared
  • Loading branch information
jglick committed Jun 6, 2017
2 parents f32bca9 + 273cb15 commit b627d39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Expand Up @@ -132,16 +132,15 @@ public static class Execution extends AbstractStepExecutionImpl {
toolName = step.toolName;
DockerClient dockerClient = new DockerClient(launcher, node, toolName);

// Add a warning if the docker version is less than 1.4
VersionNumber dockerVersion = dockerClient.version();
if (dockerVersion != null) {
if (dockerVersion.isOlderThan(new VersionNumber("1.4"))) {
throw new AbortException("The docker version is less than v1.4. Pipeline functions requiring 'docker exec' will not work e.g. 'docker.inside'.");
if (dockerVersion.isOlderThan(new VersionNumber("1.7"))) {
throw new AbortException("The docker version is less than v1.7. Pipeline functions requiring 'docker exec' (e.g. 'docker.inside') or SELinux labeling will not work.");
} else if (dockerVersion.isOlderThan(new VersionNumber("1.8"))) {
listener.error("The docker version is less than v1.8. Running a 'docker.inside' from inside a container will not work.");
}
} else {
listener.error("Failed to parse docker version. Please note there is a minimum docker version requirement of v1.4.");
listener.error("Failed to parse docker version. Please note there is a minimum docker version requirement of v1.7.");
}

FilePath tempDir = tempDir(workspace);
Expand Down
Expand Up @@ -110,7 +110,7 @@ public String run(@Nonnull EnvVars launchEnv, @Nonnull String image, @CheckForNu
argb.add("-w", workdir);
}
for (Map.Entry<String, String> volume : volumes.entrySet()) {
argb.add("-v", volume.getKey() + ":" + volume.getValue() + ":rw");
argb.add("-v", volume.getKey() + ":" + volume.getValue() + ":rw,z");
}
for (String containerId : volumesFromContainers) {
argb.add("--volumes-from", containerId);
Expand Down

0 comments on commit b627d39

Please sign in to comment.