mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Allow Docker destinations to use --volumes-from option.
Enables certain kind of Docker-to-Docker job executions. Thanks to Andrew Stewart.
This commit is contained in:
@@ -154,6 +154,11 @@
|
||||
are available to all jobs and $job_directory is also available for
|
||||
Pulsar jobs.
|
||||
-->
|
||||
<!-- One can run docker using volumes-from tag by setting the following
|
||||
parameter. For more information on volumes-from check out the following
|
||||
docker tutorial. https://docs.docker.com/userguide/dockervolumes/
|
||||
-->
|
||||
<!-- <param id="docker_volumes_from">parent_container_name</param> -->
|
||||
<!-- Control memory allocatable by docker container with following option:
|
||||
-->
|
||||
<!-- <param id="docker_memory">24G</param> -->
|
||||
|
||||
@@ -190,10 +190,12 @@ class DockerContainer(Container):
|
||||
volumes_raw = self.__expand_str(self.destination_info.get("docker_volumes", "$defaults"))
|
||||
# TODO: Remove redundant volumes...
|
||||
volumes = docker_util.DockerVolume.volumes_from_str(volumes_raw)
|
||||
volumes_from = self.destination_info.get("docker_volumes_from", docker_util.DEFAULT_VOLUMES_FROM)
|
||||
return docker_util.build_docker_run_command(
|
||||
command,
|
||||
self.container_id,
|
||||
volumes=volumes,
|
||||
volumes_from=volumes_from,
|
||||
env_directives=env_directives,
|
||||
working_directory=working_directory,
|
||||
docker_cmd=prop("cmd", docker_util.DEFAULT_DOCKER_COMMAND),
|
||||
|
||||
@@ -7,6 +7,7 @@ DEFAULT_VOLUME_MOUNT_TYPE = "rw"
|
||||
DEFAULT_WORKING_DIRECTORY = None
|
||||
DEFAULT_NET = None
|
||||
DEFAULT_MEMORY = None
|
||||
DEFAULT_VOLUMES_FROM = None
|
||||
|
||||
|
||||
class DockerVolume(object):
|
||||
@@ -55,6 +56,7 @@ def build_docker_run_command(
|
||||
tag=None,
|
||||
docker_cmd=DEFAULT_DOCKER_COMMAND,
|
||||
volumes=[],
|
||||
volumes_from=DEFAULT_VOLUMES_FROM,
|
||||
memory=DEFAULT_MEMORY,
|
||||
env_directives=[],
|
||||
working_directory=DEFAULT_WORKING_DIRECTORY,
|
||||
@@ -75,6 +77,8 @@ def build_docker_run_command(
|
||||
command_parts.extend(["-e", env_directive])
|
||||
for volume in volumes:
|
||||
command_parts.extend(["-v", str(volume)])
|
||||
if volumes_from:
|
||||
command_parts.extend(["--volumes-from", str(volumes_from)])
|
||||
if memory:
|
||||
command_parts.extend(["-m", memory])
|
||||
if name:
|
||||
|
||||
Reference in New Issue
Block a user