File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -240,6 +240,9 @@ func loadSpec(cPath string) (spec *specs.Spec, err error) {
240
240
if err = json .NewDecoder (cf ).Decode (& spec ); err != nil {
241
241
return nil , err
242
242
}
243
+ if err = validatePlatform (& spec .Platform ); err != nil {
244
+ return nil , err
245
+ }
243
246
return spec , validateProcessSpec (& spec .Process )
244
247
}
245
248
@@ -254,3 +257,13 @@ func createLibContainerRlimit(rlimit specs.Rlimit) (configs.Rlimit, error) {
254
257
Soft : uint64 (rlimit .Soft ),
255
258
}, nil
256
259
}
260
+
261
+ func validatePlatform (platform * specs.Platform ) error {
262
+ if platform .OS != runtime .GOOS {
263
+ return fmt .Errorf ("target os %s mismatch with current os %s" , platform .OS , runtime .GOOS )
264
+ }
265
+ if platform .Arch != runtime .GOARCH {
266
+ return fmt .Errorf ("target arch %s mismatch with current arch %s" , platform .Arch , runtime .GOARCH )
267
+ }
268
+ return nil
269
+ }
You can’t perform that action at this time.
0 commit comments