Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit a348354

Browse files
authored
Merge pull request #397 from joshwget/group-add
Add group_add
2 parents e76f2c1 + 7c53627 commit a348354

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

config/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type ServiceConfigV1 struct {
3636
Entrypoint yaml.Command `yaml:"entrypoint,flow,omitempty"`
3737
EnvFile yaml.Stringorslice `yaml:"env_file,omitempty"`
3838
Environment yaml.MaporEqualSlice `yaml:"environment,omitempty"`
39+
GroupAdd []string `yaml:"group_add,omitempty"`
3940
Hostname string `yaml:"hostname,omitempty"`
4041
Image string `yaml:"image,omitempty"`
4142
Labels yaml.SliceorMap `yaml:"labels,omitempty"`
@@ -101,6 +102,7 @@ type ServiceConfig struct {
101102
Extends yaml.MaporEqualSlice `yaml:"extends,omitempty"`
102103
ExternalLinks []string `yaml:"external_links,omitempty"`
103104
ExtraHosts []string `yaml:"extra_hosts,omitempty"`
105+
GroupAdd []string `yaml:"group_add,omitempty"`
104106
Image string `yaml:"image,omitempty"`
105107
Hostname string `yaml:"hostname,omitempty"`
106108
Ipc string `yaml:"ipc,omitempty"`

docker/service/convert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ func Convert(c *config.ServiceConfig, ctx project.Context, clientFactory compose
243243
VolumesFrom: volumesFrom,
244244
CapAdd: strslice.StrSlice(utils.CopySlice(c.CapAdd)),
245245
CapDrop: strslice.StrSlice(utils.CopySlice(c.CapDrop)),
246+
GroupAdd: c.GroupAdd,
246247
ExtraHosts: utils.CopySlice(c.ExtraHosts),
247248
Privileged: c.Privileged,
248249
Binds: Filter(vols, isBind),

docker/service/convert_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,23 @@ func TestParseLabels(t *testing.T) {
8181
assert.Equal(t, []string{"less"}, []string(cfg.Entrypoint))
8282
}
8383

84+
func TestGroupAdd(t *testing.T) {
85+
ctx := &ctx.Context{}
86+
sc := &config.ServiceConfig{
87+
GroupAdd: []string{
88+
"root",
89+
"1",
90+
},
91+
}
92+
_, hostCfg, err := Convert(sc, ctx.Context, nil)
93+
assert.Nil(t, err)
94+
95+
assert.True(t, reflect.DeepEqual([]string{
96+
"root",
97+
"1",
98+
}, hostCfg.GroupAdd))
99+
}
100+
84101
func TestOomScoreAdj(t *testing.T) {
85102
ctx := &ctx.Context{}
86103
sc := &config.ServiceConfig{

0 commit comments

Comments
 (0)