mirror of https://github.com/docker/cli.git
Add `init` support in 3.7 schema
> Run an init inside the container that forwards signals and reaps processes This is supported on `run` and now on Swarm services too, so it's also possible to have in on a composefile :). Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
e529043c51
commit
cc26da94ed
|
@ -150,6 +150,7 @@ func Service(
|
||||||
ReadOnly: service.ReadOnly,
|
ReadOnly: service.ReadOnly,
|
||||||
Privileges: &privileges,
|
Privileges: &privileges,
|
||||||
Isolation: container.Isolation(service.Isolation),
|
Isolation: container.Isolation(service.Isolation),
|
||||||
|
Init: service.Init,
|
||||||
},
|
},
|
||||||
LogDriver: logDriver,
|
LogDriver: logDriver,
|
||||||
Resources: resources,
|
Resources: resources,
|
||||||
|
|
|
@ -1415,3 +1415,60 @@ networks:
|
||||||
}
|
}
|
||||||
assert.DeepEqual(t, config, expected, cmpopts.EquateEmpty())
|
assert.DeepEqual(t, config, expected, cmpopts.EquateEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLoadInit(t *testing.T) {
|
||||||
|
booleanFalse := false
|
||||||
|
booleanTrue := true
|
||||||
|
config, err := loadYAML(`
|
||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
foo:
|
||||||
|
image: alpine`)
|
||||||
|
assert.NilError(t, err)
|
||||||
|
assert.Check(t, is.DeepEqual(config, &types.Config{
|
||||||
|
Filename: "filename.yml",
|
||||||
|
Version: "3.7",
|
||||||
|
Services: types.Services{
|
||||||
|
{
|
||||||
|
Name: "foo",
|
||||||
|
Image: "alpine",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, cmpopts.EquateEmpty()))
|
||||||
|
config, err = loadYAML(`
|
||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
foo:
|
||||||
|
image: alpine
|
||||||
|
init: true`)
|
||||||
|
assert.NilError(t, err)
|
||||||
|
assert.Check(t, is.DeepEqual(config, &types.Config{
|
||||||
|
Filename: "filename.yml",
|
||||||
|
Version: "3.7",
|
||||||
|
Services: types.Services{
|
||||||
|
{
|
||||||
|
Name: "foo",
|
||||||
|
Image: "alpine",
|
||||||
|
Init: &booleanTrue,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, cmpopts.EquateEmpty()))
|
||||||
|
config, err = loadYAML(`
|
||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
foo:
|
||||||
|
image: alpine
|
||||||
|
init: false`)
|
||||||
|
assert.NilError(t, err)
|
||||||
|
assert.Check(t, is.DeepEqual(config, &types.Config{
|
||||||
|
Filename: "filename.yml",
|
||||||
|
Version: "3.7",
|
||||||
|
Services: types.Services{
|
||||||
|
{
|
||||||
|
Name: "foo",
|
||||||
|
Image: "alpine",
|
||||||
|
Init: &booleanFalse,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, cmpopts.EquateEmpty()))
|
||||||
|
}
|
||||||
|
|
|
@ -467,7 +467,7 @@ DoTuq9lAU9Q4O1xV/59X/w8AAP//zRo7vm9CAAA=
|
||||||
|
|
||||||
"/data/config_schema_v3.7.json": {
|
"/data/config_schema_v3.7.json": {
|
||||||
local: "data/config_schema_v3.7.json",
|
local: "data/config_schema_v3.7.json",
|
||||||
size: 17740,
|
size: 17777,
|
||||||
modtime: 1518458244,
|
modtime: 1518458244,
|
||||||
compressed: `
|
compressed: `
|
||||||
H4sIAAAAAAAC/+xcS4/bOBK++1cYmrlNPwLsYBeb2x73tHvehiPQVNnmNEVyipTTTuD/vtDTEkWKlK1O
|
H4sIAAAAAAAC/+xcS4/bOBK++1cYmrlNPwLsYBeb2x73tHvehiPQVNnmNEVyipTTTuD/vtDTEkWKlK1O
|
||||||
|
@ -484,27 +484,27 @@ q261wbY83KwjrNLhLgLuJuxwSkuXBdJY/zH3HK3XScGyeOL9HOJcZsN9iyLfAibnEfHokA5+36xcbyzt
|
||||||
G8IEYCpIDkE7RshAGEZ4qhXQAXmrqQnNJFH+PEHYM23w5KS8cNHfWAYKRKbTOoKZ73qTDLpwZlE3kYmp
|
G8IEYC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4UVEDeSqrhFf7iBi8Nn5rVNIpy3ZAgFaTBdXVBtRQ5VKtXwdI9wqtAln0Zki+VIeNrqxKnEGDO/BdxZb
|
||||||
O+/GzZMerT51Cam7TlabaBV7D8Zy+69yY3bx0ZVEI8YQeojKt81Me/yA9OUoXe90aQ3Vh0eb4dF+dvt/
|
4UlTv2/feTfusPRo9alLSN11stpEq9h7MJbbf5Ubs4uPriQaMYbQQ1S+bWba4wekL0fpeqdLa6g+PNoM
|
||||||
f7bafOEZ/Iqwogp/lHmDhUZ8jvEO9P+TqHV0CTvV2lB9qPVnUavVdNNT77j4MyXx6M7gVb/W023DJnP8
|
j/az2//7s9XmM9Dgp4YVVfjLzRssNOKbjXeg/59EraNL2KnWhupDrT+LWq2mm556x8WfKYlHdwav+rWe
|
||||||
Pw2+CMu7KV+p0lq0EfY05wveWw+/TSDZqQ7+V4KAC7Q7unVqpVBWXXOj/Zm535e040cfnZd8itOoOPl9
|
bhs2meM/c/BFWN5N+UqV1qKNsKc5X/DeevhtAslOdfC/EgRcoN3RrVMrhbLqmhvtb9H9vqQdP/oyveRT
|
||||||
2OBSfzC+GcjHIqk/nOkBhU1UYO76FN1ur2k/Cfd0/A2j11X597z6fwAAAP//5FICNUxFAAA=
|
nEbFye/DBpf6q/LNQD4WSf11TQ8obKICc9f36nZ7TfvduKfjbxi9rsq/59X/AwAA//+9o87pcUUAAA==
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,7 @@
|
||||||
"healthcheck": {"$ref": "#/definitions/healthcheck"},
|
"healthcheck": {"$ref": "#/definitions/healthcheck"},
|
||||||
"hostname": {"type": "string"},
|
"hostname": {"type": "string"},
|
||||||
"image": {"type": "string"},
|
"image": {"type": "string"},
|
||||||
|
"init": {"type": "boolean"},
|
||||||
"ipc": {"type": "string"},
|
"ipc": {"type": "string"},
|
||||||
"isolation": {"type": "string"},
|
"isolation": {"type": "string"},
|
||||||
"labels": {"$ref": "#/definitions/list_or_dict"},
|
"labels": {"$ref": "#/definitions/list_or_dict"},
|
||||||
|
|
|
@ -119,7 +119,9 @@ type ServiceConfig struct {
|
||||||
Hostname string `yaml:",omitempty"`
|
Hostname string `yaml:",omitempty"`
|
||||||
HealthCheck *HealthCheckConfig `yaml:",omitempty"`
|
HealthCheck *HealthCheckConfig `yaml:",omitempty"`
|
||||||
Image string `yaml:",omitempty"`
|
Image string `yaml:",omitempty"`
|
||||||
|
Init *bool `yaml:",omitempty"`
|
||||||
Ipc string `yaml:",omitempty"`
|
Ipc string `yaml:",omitempty"`
|
||||||
|
Isolation string `mapstructure:"isolation" yaml:"isolation,omitempty"`
|
||||||
Labels Labels `yaml:",omitempty"`
|
Labels Labels `yaml:",omitempty"`
|
||||||
Links []string `yaml:",omitempty"`
|
Links []string `yaml:",omitempty"`
|
||||||
Logging *LoggingConfig `yaml:",omitempty"`
|
Logging *LoggingConfig `yaml:",omitempty"`
|
||||||
|
@ -142,8 +144,8 @@ type ServiceConfig struct {
|
||||||
User string `yaml:",omitempty"`
|
User string `yaml:",omitempty"`
|
||||||
Volumes []ServiceVolumeConfig `yaml:",omitempty"`
|
Volumes []ServiceVolumeConfig `yaml:",omitempty"`
|
||||||
WorkingDir string `mapstructure:"working_dir" yaml:"working_dir,omitempty"`
|
WorkingDir string `mapstructure:"working_dir" yaml:"working_dir,omitempty"`
|
||||||
Isolation string `mapstructure:"isolation" yaml:"isolation,omitempty"`
|
|
||||||
Extras map[string]interface{} `yaml:",inline"`
|
Extras map[string]interface{} `yaml:",inline"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildConfig is a type for build
|
// BuildConfig is a type for build
|
||||||
|
|
Loading…
Reference in New Issue