File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 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) {
240240 if err = json .NewDecoder (cf ).Decode (& spec ); err != nil {
241241 return nil , err
242242 }
243+ if err = validatePlatform (& spec .Platform ); err != nil {
244+ return nil , err
245+ }
243246 return spec , validateProcessSpec (& spec .Process )
244247}
245248
@@ -254,3 +257,13 @@ func createLibContainerRlimit(rlimit specs.Rlimit) (configs.Rlimit, error) {
254257 Soft : uint64 (rlimit .Soft ),
255258 }, nil
256259}
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