diff --git a/utils.go b/utils.go index 4f3a846d75..85bf61e8e2 100644 --- a/utils.go +++ b/utils.go @@ -132,6 +132,9 @@ func MergeConfig(userConf, imageConf *Config) { if userConf.Entrypoint == nil || len(userConf.Entrypoint) == 0 { userConf.Entrypoint = imageConf.Entrypoint } + if userConf.VolumesFrom == "" { + userConf.VolumesFrom = imageConf.VolumesFrom + } if userConf.Volumes == nil || len(userConf.Volumes) == 0 { userConf.Volumes = imageConf.Volumes } else { diff --git a/utils_test.go b/utils_test.go index 95f3d4bfdd..90292ef9d0 100644 --- a/utils_test.go +++ b/utils_test.go @@ -191,10 +191,11 @@ func TestMergeConfig(t *testing.T) { volumesImage["/test1"] = struct{}{} volumesImage["/test2"] = struct{}{} configImage := &Config{ - Dns: []string{"1.1.1.1", "2.2.2.2"}, - PortSpecs: []string{"1111:1111", "2222:2222"}, - Env: []string{"VAR1=1", "VAR2=2"}, - Volumes: volumesImage, + Dns: []string{"1.1.1.1", "2.2.2.2"}, + PortSpecs: []string{"1111:1111", "2222:2222"}, + Env: []string{"VAR1=1", "VAR2=2"}, + VolumesFrom: "1111", + Volumes: volumesImage, } volumesUser := make(map[string]struct{}) @@ -242,4 +243,8 @@ func TestMergeConfig(t *testing.T) { t.Fatalf("Expected /test1 or /test2 or /test3, found %s", v) } } + + if configUser.VolumesFrom != "1111" { + t.Fatalf("Expected VolumesFrom to be 1111, found %s", configUser.VolumesFrom) + } }