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

Commit 0e7e65f

Browse files
authored
Merge pull request #405 from joshwget/isolation
Add isolation
2 parents 1aabe29 + fdcbe4c commit 0e7e65f

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

config/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type ServiceConfigV1 struct {
4040
GroupAdd []string `yaml:"group_add,omitempty"`
4141
Hostname string `yaml:"hostname,omitempty"`
4242
Image string `yaml:"image,omitempty"`
43+
Isolation string `yaml:"isolation,omitempty"`
4344
Labels yaml.SliceorMap `yaml:"labels,omitempty"`
4445
Links yaml.MaporColonSlice `yaml:"links,omitempty"`
4546
LogDriver string `yaml:"log_driver,omitempty"`
@@ -107,6 +108,7 @@ type ServiceConfig struct {
107108
ExtraHosts []string `yaml:"extra_hosts,omitempty"`
108109
GroupAdd []string `yaml:"group_add,omitempty"`
109110
Image string `yaml:"image,omitempty"`
111+
Isolation string `yaml:"isolation,omitempty"`
110112
Hostname string `yaml:"hostname,omitempty"`
111113
Ipc string `yaml:"ipc,omitempty"`
112114
Labels yaml.SliceorMap `yaml:"labels,omitempty"`

docker/service/convert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ func Convert(c *config.ServiceConfig, ctx project.Context, clientFactory compose
253253
DNS: utils.CopySlice(c.DNS),
254254
DNSOptions: utils.CopySlice(c.DNSOpts),
255255
DNSSearch: utils.CopySlice(c.DNSSearch),
256+
Isolation: container.Isolation(c.Isolation),
256257
LogConfig: container.LogConfig{
257258
Type: c.Logging.Driver,
258259
Config: utils.CopyMap(c.Logging.Options),

docker/service/convert_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"reflect"
66
"testing"
77

8+
"github.com/docker/docker/api/types/container"
89
"github.com/docker/libcompose/config"
910
"github.com/docker/libcompose/docker/ctx"
1011
"github.com/docker/libcompose/lookup"
@@ -115,6 +116,17 @@ func TestGroupAdd(t *testing.T) {
115116
}, hostCfg.GroupAdd))
116117
}
117118

119+
func TestIsolation(t *testing.T) {
120+
ctx := &ctx.Context{}
121+
sc := &config.ServiceConfig{
122+
Isolation: "default",
123+
}
124+
_, hostCfg, err := Convert(sc, ctx.Context, nil)
125+
assert.Nil(t, err)
126+
127+
assert.Equal(t, container.Isolation("default"), hostCfg.Isolation)
128+
}
129+
118130
func TestMemSwappiness(t *testing.T) {
119131
ctx := &ctx.Context{}
120132
sc := &config.ServiceConfig{

0 commit comments

Comments
 (0)