Skip to content

Commit

Permalink
Support volumes_from
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsauter committed Jul 9, 2018
1 parent 76dee9d commit ec7f839
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions crane/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit ec7f839

Please sign in to comment.