From ec7f839870b407fc2bb08678b852e616b4916225 Mon Sep 17 00:00:00 2001 From: Michael Sauter Date: Mon, 9 Jul 2018 22:01:39 +0200 Subject: [PATCH] Support volumes_from --- CHANGELOG.md | 2 ++ crane/container.go | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ba2e11..050c1ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +* [Enhancement] Support `volumes_from` config of docker-compose (`volumes-from` was already supported). + * [Enhancement] Add `--config`, `-tag` and `--prefix` flags to shortcut command if those flags are specified for the original Crane command as well. ## 3.4.1 (2018-04-04) diff --git a/crane/container.go b/crane/container.go index ff2c1c3..4272a59 100644 --- a/crane/container.go +++ b/crane/container.go @@ -162,6 +162,7 @@ type container struct { RawVolumeDriver string `json:"volume-driver" yaml:"volume-driver"` RawVolume_Driver string `json:"volume_driver" yaml:"volume_driver"` RawVolumesFrom []string `json:"volumes-from" yaml:"volumes-from"` + RawVolumes_From []string `json:"volumes_from" yaml:"volumes_from"` RawWorkdir string `json:"workdir" yaml:"workdir"` RawWorking_Dir string `json:"working_dir" yaml:"working_dir"` RawCmd interface{} `json:"cmd" yaml:"cmd"` @@ -849,8 +850,12 @@ func (c *container) VolumeDriver() string { func (c *container) VolumesFrom() []string { var volumesFrom []string - for _, rawVolumesFrom := range c.RawVolumesFrom { - volumesFrom = append(volumesFrom, expandEnv(rawVolumesFrom)) + rawVolumesFrom := c.RawVolumes_From + if len(c.RawVolumesFrom) > 0 { + rawVolumesFrom = c.RawVolumesFrom + } + for _, raw := range rawVolumesFrom { + volumesFrom = append(volumesFrom, expandEnv(raw)) } return volumesFrom }