Skip to content

Commit b708de9

Browse files
authored
feat:[close #283] Allow creating unshared containers in Apx core
1 parent 38939a1 commit b708de9

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

cmd/subsyStems.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func newSubSystem(cmd *cobra.Command, args []string) error {
224224
return err
225225
}
226226

227-
subSystem, err := core.NewSubSystem(subSystemName, stack, false, false, false)
227+
subSystem, err := core.NewSubSystem(subSystemName, stack, false, false, false, false)
228228
if err != nil {
229229
return err
230230
}

core/dbox.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func (d *dbox) ContainerDelete(name string, rootFull bool) error {
208208
return err
209209
}
210210

211-
func (d *dbox) CreateContainer(name string, image string, additionalPackages []string, labels map[string]string, withInit bool, rootFull bool) error {
211+
func (d *dbox) CreateContainer(name string, image string, additionalPackages []string, labels map[string]string, withInit bool, rootFull bool, unshared bool) error {
212212
args := []string{
213213
"--image", image,
214214
"--name", name,
@@ -224,6 +224,10 @@ func (d *dbox) CreateContainer(name string, image string, additionalPackages []s
224224
args = append(args, "--init")
225225
}
226226

227+
if unshared {
228+
args = append(args, "--unshare-all")
229+
}
230+
227231
if len(additionalPackages) > 0 {
228232
args = append(args, "--additional-packages")
229233
args = append(args, strings.Join(additionalPackages, " "))

core/subSystem.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,19 @@ type SubSystem struct {
2929
HasInit bool
3030
IsManaged bool
3131
IsRootfull bool
32+
IsUnshared bool
3233
}
3334

34-
func NewSubSystem(name string, stack *Stack, hasInit bool, isManaged bool, IsRootfull bool) (*SubSystem, error) {
35+
func NewSubSystem(name string, stack *Stack, hasInit bool, isManaged bool, isRootfull bool, isUnshared bool) (*SubSystem, error) {
3536
internalName := genInternalName(name)
3637
return &SubSystem{
3738
InternalName: internalName,
3839
Name: name,
3940
Stack: stack,
4041
HasInit: hasInit,
4142
IsManaged: isManaged,
42-
IsRootfull: IsRootfull,
43+
IsRootfull: isRootfull,
44+
IsUnshared: isUnshared,
4345
}, nil
4446
}
4547

@@ -133,6 +135,7 @@ func (s *SubSystem) Create() error {
133135
labels,
134136
s.HasInit,
135137
s.IsRootfull,
138+
s.IsUnshared,
136139
)
137140
if err != nil {
138141
return err

0 commit comments

Comments
 (0)