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

Commit fdcbe4c

Browse files
committed
Add isolation
Signed-off-by: Josh Curl <[email protected]>
1 parent c0bb633 commit fdcbe4c

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
@@ -39,6 +39,7 @@ type ServiceConfigV1 struct {
3939
GroupAdd []string `yaml:"group_add,omitempty"`
4040
Hostname string `yaml:"hostname,omitempty"`
4141
Image string `yaml:"image,omitempty"`
42+
Isolation string `yaml:"isolation,omitempty"`
4243
Labels yaml.SliceorMap `yaml:"labels,omitempty"`
4344
Links yaml.MaporColonSlice `yaml:"links,omitempty"`
4445
LogDriver string `yaml:"log_driver,omitempty"`
@@ -105,6 +106,7 @@ type ServiceConfig struct {
105106
ExtraHosts []string `yaml:"extra_hosts,omitempty"`
106107
GroupAdd []string `yaml:"group_add,omitempty"`
107108
Image string `yaml:"image,omitempty"`
109+
Isolation string `yaml:"isolation,omitempty"`
108110
Hostname string `yaml:"hostname,omitempty"`
109111
Ipc string `yaml:"ipc,omitempty"`
110112
Labels yaml.SliceorMap `yaml:"labels,omitempty"`

docker/service/convert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ func Convert(c *config.ServiceConfig, ctx project.Context, clientFactory compose
252252
Binds: Filter(vols, isBind),
253253
DNS: utils.CopySlice(c.DNS),
254254
DNSSearch: utils.CopySlice(c.DNSSearch),
255+
Isolation: container.Isolation(c.Isolation),
255256
LogConfig: container.LogConfig{
256257
Type: c.Logging.Driver,
257258
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"
@@ -98,6 +99,17 @@ func TestGroupAdd(t *testing.T) {
9899
}, hostCfg.GroupAdd))
99100
}
100101

102+
func TestIsolation(t *testing.T) {
103+
ctx := &ctx.Context{}
104+
sc := &config.ServiceConfig{
105+
Isolation: "default",
106+
}
107+
_, hostCfg, err := Convert(sc, ctx.Context, nil)
108+
assert.Nil(t, err)
109+
110+
assert.Equal(t, container.Isolation("default"), hostCfg.Isolation)
111+
}
112+
101113
func TestMemSwappiness(t *testing.T) {
102114
ctx := &ctx.Context{}
103115
sc := &config.ServiceConfig{

0 commit comments

Comments
 (0)