Skip to content

Commit

Permalink
Added configuration for volume imports
Browse files Browse the repository at this point in the history
  • Loading branch information
grkvlt committed Apr 1, 2016
1 parent 5b8169b commit d162648
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ private DockerAttributes() { }
new TypeToken<List<String>>() { },
"docker.container.volumes.export", "Container volume export configuration");

public static final ConfigKey<List<String>> DOCKER_CONTAINER_VOLUMES_FROM = ConfigKeys.newConfigKey(
new TypeToken<List<String>>() { },
"docker.container.volumes.import", "Container volume import configuration");

public static final AttributeSensor<Map<String, String>> DOCKER_VOLUME_MAPPING = Sensors.newSensor(
new TypeToken<Map<String, String>>() { },
"docker.container.volumes", "Container volume mappings");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ public interface DockerContainer extends BasicStartable, HasNetworkAddresses, Ha
@SetFromFlag("volumes")
ConfigKey<List<String>> DOCKER_CONTAINER_VOLUME_EXPORT = DockerAttributes.DOCKER_CONTAINER_VOLUME_EXPORT;

@SetFromFlag("volumesFrom")
ConfigKey<List<String>> DOCKER_CONTAINER_VOLUMES_FROM = DockerAttributes.DOCKER_CONTAINER_VOLUMES_FROM;

@SetFromFlag("env")
AttributeSensorAndConfigKey<Map<String, Object>, Map<String, Object>> DOCKER_CONTAINER_ENVIRONMENT = ConfigKeys.newSensorAndConfigKey(
new TypeToken<Map<String, Object>>() { },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ private DockerTemplateOptions getDockerTemplateOptions() {
sensors().set(DockerAttributes.DOCKER_VOLUME_MAPPING, volumes);
entity.sensors().set(DockerAttributes.DOCKER_VOLUME_MAPPING, volumes);
options.volumes(volumes);
List<String> imports = entity.config().get(DockerContainer.DOCKER_CONTAINER_VOLUMES_FROM);
if (imports != null) {
options.volumesFrom(imports);
}

// Direct port mappings
Map<Integer, Integer> bindings = MutableMap.copyOf(entity.config().get(DockerAttributes.DOCKER_PORT_BINDINGS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public interface VanillaDockerApplication extends VanillaSoftwareProcess {
@SetFromFlag("volumes")
ConfigKey<List<String>> DOCKER_CONTAINER_VOLUME_EXPORT = DockerAttributes.DOCKER_CONTAINER_VOLUME_EXPORT;

@SetFromFlag("volumesFrom")
ConfigKey<List<String>> DOCKER_CONTAINER_VOLUMES_FROM = DockerAttributes.DOCKER_CONTAINER_VOLUMES_FROM;

@SetFromFlag("volumeMappings")
AttributeSensorAndConfigKey<Map<String, String>, Map<String, String>> DOCKER_HOST_VOLUME_MAPPING = DockerAttributes.DOCKER_HOST_VOLUME_MAPPING;

Expand Down

0 comments on commit d162648

Please sign in to comment.