github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/specgenutil/createparse.go (about)

     1  package specgenutil
     2  
     3  import (
     4  	"github.com/containers/common/pkg/config"
     5  	"github.com/hanks177/podman/v4/pkg/domain/entities"
     6  	"github.com/pkg/errors"
     7  )
     8  
     9  // validate determines if the flags and values given by the user are valid. things checked
    10  // by validate must not need any state information on the flag (i.e. changed)
    11  func validate(c *entities.ContainerCreateOptions) error {
    12  	var ()
    13  	if c.Rm && (c.Restart != "" && c.Restart != "no" && c.Restart != "on-failure") {
    14  		return errors.Errorf(`the --rm option conflicts with --restart, when the restartPolicy is not "" and "no"`)
    15  	}
    16  
    17  	if _, err := config.ParsePullPolicy(c.Pull); err != nil {
    18  		return err
    19  	}
    20  
    21  	return config.ValidateImageVolumeMode(c.ImageVolume)
    22  }