Skip to content

Commit a5e6ba1

Browse files
committed
merge branch 'pr-1743'
The setupUserNamespace function is always called. LGTMs: @crosbymichael @mrunalp @cyphar Closes #1743
2 parents f0f04ad + f7554fd commit a5e6ba1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libcontainer/specconv/spec_linux.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,6 @@ func CreateLibcontainerConfig(opts *CreateOpts) (*configs.Config, error) {
192192
if err := createDevices(spec, config); err != nil {
193193
return nil, err
194194
}
195-
if err := setupUserNamespace(spec, config); err != nil {
196-
return nil, err
197-
}
198195
c, err := createCgroupConfig(opts)
199196
if err != nil {
200197
return nil, err
@@ -226,6 +223,11 @@ func CreateLibcontainerConfig(opts *CreateOpts) (*configs.Config, error) {
226223
},
227224
}
228225
}
226+
if config.Namespaces.Contains(configs.NEWUSER) {
227+
if err := setupUserNamespace(spec, config); err != nil {
228+
return nil, err
229+
}
230+
}
229231
config.MaskPaths = spec.Linux.MaskedPaths
230232
config.ReadonlyPaths = spec.Linux.ReadonlyPaths
231233
config.MountLabel = spec.Linux.MountLabel

0 commit comments

Comments
 (0)