mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add expanded port syntax to Compose schema and types.
This commit adds expanded port syntax to Compose schema and types so that it is possible to have ``` ports: - mode: host target: 80 published: 9005 ``` Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
09114fe9f0
commit
60c1eaf8f0
3 changed files with 24 additions and 4 deletions
File diff suppressed because one or more lines are too long
|
@ -167,8 +167,20 @@
|
|||
"ports": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": ["string", "number"],
|
||||
"format": "ports"
|
||||
"oneOf": [
|
||||
{"type": "number", "format": "ports"},
|
||||
{"type": "string", "format": "ports"},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"mode": {"type": "string"},
|
||||
"target": {"type": "integer"},
|
||||
"published": {"type": "integer"},
|
||||
"protocol": {"type": "string"}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"uniqueItems": true
|
||||
},
|
||||
|
|
|
@ -106,7 +106,7 @@ type ServiceConfig struct {
|
|||
NetworkMode string `mapstructure:"network_mode"`
|
||||
Networks map[string]*ServiceNetworkConfig
|
||||
Pid string
|
||||
Ports StringOrNumberList
|
||||
Ports []ServicePortConfig
|
||||
Privileged bool
|
||||
ReadOnly bool `mapstructure:"read_only"`
|
||||
Restart string
|
||||
|
@ -215,6 +215,14 @@ type ServiceNetworkConfig struct {
|
|||
Ipv6Address string `mapstructure:"ipv6_address"`
|
||||
}
|
||||
|
||||
// ServicePortConfig is the port configuration for a service
|
||||
type ServicePortConfig struct {
|
||||
Mode string
|
||||
Target uint32
|
||||
Published uint32
|
||||
Protocol string
|
||||
}
|
||||
|
||||
// ServiceSecretConfig is the secret configuration for a service
|
||||
type ServiceSecretConfig struct {
|
||||
Source string
|
||||
|
|
Loading…
Add table
Reference in a new issue