diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/common.go | 4 | ||||
-rw-r--r-- | cmd/podman/main.go | 20 | ||||
-rw-r--r-- | cmd/podman/main_local.go | 27 | ||||
-rw-r--r-- | cmd/podman/main_remote.go | 6 | ||||
-rw-r--r-- | cmd/podman/search.go | 13 | ||||
-rw-r--r-- | cmd/podman/shared/create.go | 6 | ||||
-rw-r--r-- | cmd/podman/shared/intermediate.go | 1 |
7 files changed, 39 insertions, 38 deletions
diff --git a/cmd/podman/common.go b/cmd/podman/common.go index eac96d3ba..8aca08248 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -313,6 +313,10 @@ func getCreateFlags(c *cliconfig.PodmanCommand) { "hostname", "h", "", "Set container hostname", ) + createFlags.Bool( + "http-proxy", true, + "Set proxy environment variables in the container based on the host proxy vars", + ) createFlags.String( "image-volume", cliconfig.DefaultImageVolume, "Tells podman how to handle the builtin image volumes. The options are: 'bind', 'tmpfs', or 'ignore'", diff --git a/cmd/podman/main.go b/cmd/podman/main.go index a0f1cf401..f501ee674 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -4,7 +4,6 @@ import ( "context" "io" "os" - "syscall" "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/libpod" @@ -13,7 +12,6 @@ import ( "github.com/containers/libpod/version" "github.com/containers/storage/pkg/reexec" "github.com/opentracing/opentracing-go" - "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -118,25 +116,13 @@ func before(cmd *cobra.Command, args []string) error { } logrus.SetLevel(level) - rlimits := new(syscall.Rlimit) - rlimits.Cur = 1048576 - rlimits.Max = 1048576 - if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil { - if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil { - return errors.Wrapf(err, "error getting rlimits") - } - rlimits.Cur = rlimits.Max - if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil { - return errors.Wrapf(err, "error setting new rlimits") - } + if err := setRLimits(); err != nil { + return err } - if rootless.IsRootless() { logrus.Info("running as rootless") } - - // Be sure we can create directories with 0755 mode. - syscall.Umask(0022) + setUMask() return profileOn(cmd) } diff --git a/cmd/podman/main_local.go b/cmd/podman/main_local.go index 5afd51e28..7452965a2 100644 --- a/cmd/podman/main_local.go +++ b/cmd/podman/main_local.go @@ -4,16 +4,17 @@ package main import ( "context" - "github.com/containers/libpod/cmd/podman/cliconfig" - "github.com/containers/libpod/cmd/podman/libpodruntime" - "github.com/containers/libpod/pkg/rootless" "io/ioutil" "log/syslog" "os" "runtime/pprof" "strconv" "strings" + "syscall" + "github.com/containers/libpod/cmd/podman/cliconfig" + "github.com/containers/libpod/cmd/podman/libpodruntime" + "github.com/containers/libpod/pkg/rootless" "github.com/containers/libpod/pkg/tracing" "github.com/opentracing/opentracing-go" "github.com/pkg/errors" @@ -154,3 +155,23 @@ func setupRootless(cmd *cobra.Command, args []string) error { } return nil } +func setRLimits() error { + rlimits := new(syscall.Rlimit) + rlimits.Cur = 1048576 + rlimits.Max = 1048576 + if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil { + if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil { + return errors.Wrapf(err, "error getting rlimits") + } + rlimits.Cur = rlimits.Max + if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil { + return errors.Wrapf(err, "error setting new rlimits") + } + } + return nil +} + +func setUMask() { + // Be sure we can create directories with 0755 mode. + syscall.Umask(0022) +} diff --git a/cmd/podman/main_remote.go b/cmd/podman/main_remote.go index 2a7d184cd..a3335050a 100644 --- a/cmd/podman/main_remote.go +++ b/cmd/podman/main_remote.go @@ -41,3 +41,9 @@ func setupRootless(cmd *cobra.Command, args []string) error { } return nil } + +func setRLimits() error { + return nil +} + +func setUMask() {} diff --git a/cmd/podman/search.go b/cmd/podman/search.go index 13948aef0..b236f3055 100644 --- a/cmd/podman/search.go +++ b/cmd/podman/search.go @@ -118,16 +118,3 @@ func searchToGeneric(params []image.SearchResult) (genericParams []interface{}) } return genericParams } - -func genSearchOutputMap() map[string]string { - io := image.SearchResult{} - v := reflect.Indirect(reflect.ValueOf(io)) - values := make(map[string]string) - - for i := 0; i < v.NumField(); i++ { - key := v.Type().Field(i).Name - value := key - values[key] = strings.ToUpper(splitCamelCase(value)) - } - return values -} diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go index c521f9cb6..eac2d044d 100644 --- a/cmd/podman/shared/create.go +++ b/cmd/podman/shared/create.go @@ -624,6 +624,7 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod. GroupAdd: c.StringSlice("group-add"), Hostname: c.String("hostname"), HostAdd: c.StringSlice("add-host"), + HTTPProxy: c.Bool("http-proxy"), NoHosts: c.Bool("no-hosts"), IDMappings: idmappings, Image: imageName, @@ -725,11 +726,6 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod. return config, nil } -type namespace interface { - IsContainer() bool - Container() string -} - func CreateContainerFromCreateConfig(r *libpod.Runtime, createConfig *cc.CreateConfig, ctx context.Context, pod *libpod.Pod) (*libpod.Container, error) { runtimeSpec, err := cc.CreateConfigToOCISpec(createConfig) if err != nil { diff --git a/cmd/podman/shared/intermediate.go b/cmd/podman/shared/intermediate.go index 9c494dec5..a38e4d47a 100644 --- a/cmd/podman/shared/intermediate.go +++ b/cmd/podman/shared/intermediate.go @@ -404,6 +404,7 @@ func NewIntermediateLayer(c *cliconfig.PodmanCommand, remote bool) GenericCLIRes m["healthcheck-start-period"] = newCRString(c, "healthcheck-start-period") m["healthcheck-timeout"] = newCRString(c, "healthcheck-timeout") m["hostname"] = newCRString(c, "hostname") + m["http-proxy"] = newCRBool(c, "http-proxy") m["image-volume"] = newCRString(c, "image-volume") m["init"] = newCRBool(c, "init") m["init-path"] = newCRString(c, "init-path") |