summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/build.go3
-rw-r--r--cmd/podman/common.go8
-rw-r--r--cmd/podman/cp.go13
-rw-r--r--cmd/podman/main_local.go6
-rw-r--r--cmd/podman/tree.go2
-rw-r--r--cmd/service/main.go55
6 files changed, 66 insertions, 21 deletions
diff --git a/cmd/podman/build.go b/cmd/podman/build.go
index fbf85fc97..08d3edaa3 100644
--- a/cmd/podman/build.go
+++ b/cmd/podman/build.go
@@ -375,7 +375,8 @@ func buildCmd(c *cliconfig.BuildValues) error {
},
Target: c.Target,
}
- return runtime.Build(getContext(), c, options, containerfiles)
+ _, _, err = runtime.Build(getContext(), c, options, containerfiles)
+ return err
}
// useLayers returns false if BUILDAH_LAYERS is set to "0" or "false"
diff --git a/cmd/podman/common.go b/cmd/podman/common.go
index 69365201e..dc7590590 100644
--- a/cmd/podman/common.go
+++ b/cmd/podman/common.go
@@ -308,7 +308,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) {
)
createFlags.String(
"image-volume", cliconfig.DefaultImageVolume,
- "Tells podman how to handle the builtin image volumes. The options are: 'bind', 'tmpfs', or 'ignore'",
+ `Tells podman how to handle the builtin image volumes ("bind"|"tmpfs"|"ignore")`,
)
createFlags.Bool(
"init", false,
@@ -431,7 +431,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) {
)
createFlags.String(
"pull", "missing",
- `Pull image before creating ("always"|"missing"|"never") (default "missing")`,
+ `Pull image before creating ("always"|"missing"|"never")`,
)
createFlags.BoolP(
"quiet", "q", false,
@@ -447,7 +447,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) {
)
createFlags.String(
"restart", "",
- "Restart policy to apply when a container exits",
+ `Restart policy to apply when a container exits ("always"|"no"|"on-failure")`,
)
createFlags.Bool(
"rm", false,
@@ -492,7 +492,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) {
)
createFlags.String(
"systemd", "true",
- `Run container in systemd mode ("true"|"false"|"always" (default "true")`,
+ `Run container in systemd mode ("true"|"false"|"always")`,
)
createFlags.StringArray(
"tmpfs", []string{},
diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go
index 1e4491f33..ea97752a3 100644
--- a/cmd/podman/cp.go
+++ b/cmd/podman/cp.go
@@ -101,18 +101,7 @@ func copyBetweenHostAndContainer(runtime *libpod.Runtime, src string, dest strin
}
}()
- // We can't pause rootless containers.
- if pause && rootless.IsRootless() {
- state, err := ctr.State()
- if err != nil {
- return err
- }
- if state == define.ContainerStateRunning {
- return errors.Errorf("cannot copy into running rootless container with pause set - pass --pause=false to force copying")
- }
- }
-
- if pause && !rootless.IsRootless() {
+ if pause {
if err := ctr.Pause(); err != nil {
// An invalid state error is fine.
// The container isn't running or is already paused.
diff --git a/cmd/podman/main_local.go b/cmd/podman/main_local.go
index bc46e4652..e5b87754b 100644
--- a/cmd/podman/main_local.go
+++ b/cmd/podman/main_local.go
@@ -33,7 +33,7 @@ const remote = false
func init() {
cgroupManager := define.SystemdCgroupsManager
- cgroupHelp := "Cgroup manager to use (cgroupfs or systemd)"
+ cgroupHelp := `Cgroup manager to use ("cgroupfs"|"systemd")`
cgroupv2, _ := cgroups.IsCgroup2UnifiedMode()
if rootless.IsRootless() && !cgroupv2 {
cgroupManager = ""
@@ -50,12 +50,12 @@ func init() {
if err := rootCmd.PersistentFlags().MarkHidden("default-mounts-file"); err != nil {
logrus.Error("unable to mark default-mounts-file flag as hidden")
}
- rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.EventsBackend, "events-backend", "", "Events backend to use")
+ rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.EventsBackend, "events-backend", "", `Events backend to use ("file"|"journald"|"none")`)
// Override default --help information of `--help` global flag
var dummyHelp bool
rootCmd.PersistentFlags().BoolVar(&dummyHelp, "help", false, "Help for podman")
rootCmd.PersistentFlags().StringSliceVar(&MainGlobalOpts.HooksDir, "hooks-dir", []string{}, "Set the OCI hooks directory path (may be set multiple times)")
- rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.LogLevel, "log-level", "error", "Log messages above specified level: debug, info, warn, error, fatal or panic")
+ rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.LogLevel, "log-level", "error", `Log messages above specified level ("debug"|"info"|"warn"|"error"|"fatal"|"panic")`)
rootCmd.PersistentFlags().IntVar(&MainGlobalOpts.MaxWorks, "max-workers", 0, "The maximum number of workers for parallel operations")
if err := rootCmd.PersistentFlags().MarkHidden("max-workers"); err != nil {
logrus.Error("unable to mark max-workers flag as hidden")
diff --git a/cmd/podman/tree.go b/cmd/podman/tree.go
index cb1b3fc9c..566f96995 100644
--- a/cmd/podman/tree.go
+++ b/cmd/podman/tree.go
@@ -56,7 +56,7 @@ func treeCmd(c *cliconfig.TreeValues) error {
return errors.Wrapf(err, "error creating libpod runtime")
}
defer runtime.DeferredShutdown(false)
- imageInfo, layerInfoMap, img, err := runtime.Tree(c)
+ imageInfo, layerInfoMap, img, err := runtime.Tree(c.InputArgs[0])
if err != nil {
return err
}
diff --git a/cmd/service/main.go b/cmd/service/main.go
new file mode 100644
index 000000000..0290de892
--- /dev/null
+++ b/cmd/service/main.go
@@ -0,0 +1,55 @@
+package main
+
+import (
+ "context"
+ "fmt"
+ "os"
+
+ "github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/containers/libpod/cmd/podman/libpodruntime"
+ api "github.com/containers/libpod/pkg/api/server"
+ "github.com/containers/storage/pkg/reexec"
+ log "github.com/sirupsen/logrus"
+ "github.com/spf13/cobra"
+)
+
+func initConfig() {
+ // we can do more stuff in here.
+}
+
+func main() {
+ if reexec.Init() {
+ // We were invoked with a different argv[0] indicating that we
+ // had a specific job to do as a subprocess, and it's done.
+ return
+ }
+
+ cobra.OnInitialize(initConfig)
+ log.SetLevel(log.DebugLevel)
+
+ config := cliconfig.PodmanCommand{
+ Command: &cobra.Command{},
+ InputArgs: []string{},
+ GlobalFlags: cliconfig.MainFlags{},
+ Remote: false,
+ }
+ // Create a single runtime for http
+ runtime, err := libpodruntime.GetRuntimeDisableFDs(context.Background(), &config)
+ if err != nil {
+ fmt.Printf("error creating libpod runtime: %s", err.Error())
+ os.Exit(1)
+ }
+ defer runtime.DeferredShutdown(false)
+
+ server, err := api.NewServer(runtime)
+ if err != nil {
+ fmt.Println(err.Error())
+ os.Exit(1)
+ }
+
+ err = server.Serve()
+ if err != nil {
+ fmt.Println(err.Error())
+ os.Exit(1)
+ }
+}