diff --git a/cli/compose/loader/full-example.yml b/cli/compose/loader/full-example.yml index 35759e3e20..339f254e1f 100644 --- a/cli/compose/loader/full-example.yml +++ b/cli/compose/loader/full-example.yml @@ -13,6 +13,9 @@ services: cache_from: - foo - bar + extra_hosts: + - "ipv4.example.com:127.0.0.1" + - "ipv6.example.com:::1" labels: [FOO=BAR] diff --git a/cli/compose/loader/full-struct_test.go b/cli/compose/loader/full-struct_test.go index 050de6a4bc..6368ac4fd3 100644 --- a/cli/compose/loader/full-struct_test.go +++ b/cli/compose/loader/full-struct_test.go @@ -39,7 +39,11 @@ func services(workingDir, homeDir string) []types.ServiceConfig { Target: "foo", Network: "foo", CacheFrom: []string{"foo", "bar"}, - Labels: map[string]string{"FOO": "BAR"}, + ExtraHosts: types.HostsList{ + "ipv4.example.com:127.0.0.1", + "ipv6.example.com:::1", + }, + Labels: map[string]string{"FOO": "BAR"}, }, CapAdd: []string{"ALL"}, CapDrop: []string{"NET_ADMIN", "SYS_ADMIN"}, @@ -526,6 +530,9 @@ services: cache_from: - foo - bar + extra_hosts: + - ipv4.example.com:127.0.0.1 + - ipv6.example.com:::1 network: foo target: foo cap_add: @@ -998,6 +1005,10 @@ func fullExampleJSON(workingDir string) string { "foo", "bar" ], + "extra_hosts": [ + "ipv4.example.com:127.0.0.1", + "ipv6.example.com:::1" + ], "network": "foo", "target": "foo" }, diff --git a/cli/compose/schema/bindata.go b/cli/compose/schema/bindata.go index 0d1621e019..aec2f70aa1 100644 --- a/cli/compose/schema/bindata.go +++ b/cli/compose/schema/bindata.go @@ -583,45 +583,45 @@ ean7MQBPP+U4w19V/z+t/hsAAP//Fd/bF0ZHAAA= "/data/config_schema_v3.9.json": { name: "config_schema_v3.9.json", local: "data/config_schema_v3.9.json", - size: 18291, + size: 18362, modtime: 1518458244, compressed: ` -H4sIAAAAAAAC/+xcS4/juBG++1cI2r1tPwbIIsDOLcecknMaHoGmyja3KZJbpDztHfi/B3q2RJEibcvd -vUkHCHZaKj6K9eBXD/n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dEWxDR/ur2//FstX1XNvg+Zk0Vfr31CguNeEfkA+h/DbX+z7llla9yYiCbYecNbHmC +PJy23FJ92vLatvxBrMBqaRpYw/RqbU5B0X3Xm+FNWr8Nm8zxqyC+LNS7Kd9FsLVoq5t5zlcMIne/zKD9 +ufcjXgkmr9BM6tapVaDa9K2j9o8a+ENPN37yEwcVn+I8ufr9MW4fan6eYPxeuUXSvLs0iNrbqOKF64cP +7Oal7gcIPP2U4wx/U/3/vPlvAAAA//8VI4RoukcAAA== `, }, diff --git a/cli/compose/schema/data/config_schema_v3.9.json b/cli/compose/schema/data/config_schema_v3.9.json index 77abb87463..2557ef2ad1 100644 --- a/cli/compose/schema/data/config_schema_v3.9.json +++ b/cli/compose/schema/data/config_schema_v3.9.json @@ -88,7 +88,8 @@ "cache_from": {"$ref": "#/definitions/list_of_strings"}, "network": {"type": "string"}, "target": {"type": "string"}, - "shm_size": {"type": ["integer", "string"]} + "shm_size": {"type": ["integer", "string"]}, + "extra_hosts": {"$ref": "#/definitions/list_or_dict"} }, "additionalProperties": false } diff --git a/cli/compose/types/types.go b/cli/compose/types/types.go index f980032eea..d582477d55 100644 --- a/cli/compose/types/types.go +++ b/cli/compose/types/types.go @@ -221,6 +221,7 @@ type BuildConfig struct { Args MappingWithEquals `yaml:",omitempty" json:"args,omitempty"` Labels Labels `yaml:",omitempty" json:"labels,omitempty"` CacheFrom StringList `mapstructure:"cache_from" yaml:"cache_from,omitempty" json:"cache_from,omitempty"` + ExtraHosts HostsList `mapstructure:"extra_hosts" yaml:"extra_hosts,omitempty" json:"extra_hosts,omitempty"` Network string `yaml:",omitempty" json:"network,omitempty"` Target string `yaml:",omitempty" json:"target,omitempty"` }