errors.go 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package runconfig // import "github.com/docker/docker/runconfig"
  2. const (
  3. // ErrConflictContainerNetworkAndLinks conflict between --net=container and links
  4. ErrConflictContainerNetworkAndLinks validationError = "conflicting options: container type network can't be used with links. This would result in undefined behavior"
  5. // ErrConflictSharedNetwork conflict between private and other networks
  6. ErrConflictSharedNetwork validationError = "container sharing network namespace with another container or host cannot be connected to any other network"
  7. // ErrConflictHostNetwork conflict from being disconnected from host network or connected to host network.
  8. ErrConflictHostNetwork validationError = "container cannot be disconnected from host network or connected to host network"
  9. // ErrConflictNoNetwork conflict between private and other networks
  10. ErrConflictNoNetwork validationError = "container cannot be connected to multiple networks with one of the networks in private (none) mode"
  11. // ErrConflictNetworkAndDNS conflict between --dns and the network mode
  12. ErrConflictNetworkAndDNS validationError = "conflicting options: dns and the network mode"
  13. // ErrConflictNetworkHostname conflict between the hostname and the network mode
  14. ErrConflictNetworkHostname validationError = "conflicting options: hostname and the network mode"
  15. // ErrConflictHostNetworkAndLinks conflict between --net=host and links
  16. ErrConflictHostNetworkAndLinks validationError = "conflicting options: host type networking can't be used with links. This would result in undefined behavior"
  17. // ErrConflictContainerNetworkAndMac conflict between the mac address and the network mode
  18. ErrConflictContainerNetworkAndMac validationError = "conflicting options: mac-address and the network mode"
  19. // ErrConflictNetworkHosts conflict between add-host and the network mode
  20. ErrConflictNetworkHosts validationError = "conflicting options: custom host-to-IP mapping and the network mode"
  21. // ErrConflictNetworkPublishPorts conflict between the publish options and the network mode
  22. ErrConflictNetworkPublishPorts validationError = "conflicting options: port publishing and the container type network mode"
  23. // ErrConflictNetworkExposePorts conflict between the expose option and the network mode
  24. ErrConflictNetworkExposePorts validationError = "conflicting options: port exposing and the container type network mode"
  25. // ErrUnsupportedNetworkAndIP conflict between network mode and requested ip address
  26. ErrUnsupportedNetworkAndIP validationError = "user specified IP address is supported on user defined networks only"
  27. // ErrUnsupportedNetworkNoSubnetAndIP conflict between network with no configured subnet and requested ip address
  28. ErrUnsupportedNetworkNoSubnetAndIP validationError = "user specified IP address is supported only when connecting to networks with user configured subnets"
  29. // ErrUnsupportedNetworkAndAlias conflict between network mode and alias
  30. ErrUnsupportedNetworkAndAlias validationError = "network-scoped alias is supported only for containers in user defined networks"
  31. // ErrConflictUTSHostname conflict between the hostname and the UTS mode
  32. ErrConflictUTSHostname validationError = "conflicting options: hostname and the UTS mode"
  33. // ErrEmptyConfig when container config is nil
  34. ErrEmptyConfig validationError = "config cannot be empty in order to create a container"
  35. )
  36. type validationError string
  37. func (e validationError) Error() string {
  38. return string(e)
  39. }
  40. func (e validationError) InvalidParameter() {}
  41. type invalidJSONError struct {
  42. Err error
  43. }
  44. func (e invalidJSONError) Error() string {
  45. return "invalid JSON: " + e.Err.Error()
  46. }
  47. func (e invalidJSONError) Unwrap() error {
  48. return e.Err
  49. }
  50. func (e invalidJSONError) InvalidParameter() {}