Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/podman/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
},
cli.BoolTFlag{
Name: "sig-proxy",
Usage: "proxy received signals to the process (default true)",
Usage: "Proxy received signals to the process (default true)",
},
LatestFlag,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
},
cli.BoolTFlag{
Name: "layers",
Usage: "cache intermediate layers during build. Use BUILDAH_LAYERS environment variable to override. ",
Usage: "Cache intermediate layers during build. Use BUILDAH_LAYERS environment variable to override. ",
},
}
buildDescription = "Builds an OCI or Docker image using instructions from one\n" +
Expand Down
8 changes: 4 additions & 4 deletions cmd/podman/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ var (
checkpointFlags = []cli.Flag{
cli.BoolFlag{
Name: "keep, k",
Usage: "keep all temporary checkpoint files",
Usage: "Keep all temporary checkpoint files",
},
cli.BoolFlag{
Name: "leave-running, R",
Usage: "leave the container running after writing checkpoint to disk",
Usage: "Leave the container running after writing checkpoint to disk",
},
cli.BoolFlag{
Name: "tcp-established",
Usage: "checkpoint a container with established TCP connections",
Usage: "Checkpoint a container with established TCP connections",
},
cli.BoolFlag{
Name: "all, a",
Usage: "checkpoint all running containers",
Usage: "Checkpoint all running containers",
},
LatestFlag,
}
Expand Down
30 changes: 17 additions & 13 deletions cmd/podman/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func getImageSubCommands() []cli.Command {
}
}

func getSystemSubCommands() []cli.Command {
return []cli.Command{infoCommand}
}

func getContainerSubCommands() []cli.Command {
return []cli.Command{
attachCommand,
Expand Down Expand Up @@ -91,58 +95,58 @@ func getMainAppFlags() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "cgroup-manager",
Usage: "cgroup manager to use (cgroupfs or systemd, default systemd)",
Usage: "Cgroup manager to use (cgroupfs or systemd, default systemd)",
},
cli.StringFlag{
Name: "cni-config-dir",
Usage: "path of the configuration directory for CNI networks",
Usage: "Path of the configuration directory for CNI networks",
},
cli.StringFlag{
Name: "conmon",
Usage: "path of the conmon binary",
Usage: "Path of the conmon binary",
},
cli.StringFlag{
Name: "default-mounts-file",
Usage: "path to default mounts file",
Usage: "Path to default mounts file",
Hidden: true,
},
cli.StringSliceFlag{
Name: "hooks-dir",
Usage: "set the OCI hooks directory path (may be set multiple times)",
Usage: "Set the OCI hooks directory path (may be set multiple times)",
},
cli.IntFlag{
Name: "max-workers",
Usage: "the maximum number of workers for parallel operations",
Usage: "The maximum number of workers for parallel operations",
Hidden: true,
},
cli.StringFlag{
Name: "namespace",
Usage: "set the libpod namespace, used to create separate views of the containers and pods on the system",
Usage: "Set the libpod namespace, used to create separate views of the containers and pods on the system",
Value: "",
},
cli.StringFlag{
Name: "root",
Usage: "path to the root directory in which data, including images, is stored",
Usage: "Path to the root directory in which data, including images, is stored",
},
cli.StringFlag{
Name: "runroot",
Usage: "path to the 'run directory' where all state information is stored",
Usage: "Path to the 'run directory' where all state information is stored",
},
cli.StringFlag{
Name: "runtime",
Usage: "path to the OCI-compatible binary used to run containers, default is /usr/bin/runc",
Usage: "Path to the OCI-compatible binary used to run containers, default is /usr/bin/runc",
},
cli.StringFlag{
Name: "storage-driver, s",
Usage: "select which storage driver is used to manage storage of images and containers (default is overlay)",
Usage: "Select which storage driver is used to manage storage of images and containers (default is overlay)",
},
cli.StringSliceFlag{
Name: "storage-opt",
Usage: "used to pass an option to the storage driver",
Usage: "Used to pass an option to the storage driver",
},
cli.BoolFlag{
Name: "syslog",
Usage: "output logging information to syslog as well as the console",
Usage: "Output logging information to syslog as well as the console",
},
}
}
4 changes: 4 additions & 0 deletions cmd/podman/commands_remoteclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ func getContainerSubCommands() []cli.Command {
return []cli.Command{}
}

func getSystemSubCommands() []cli.Command {
return []cli.Command{}
}

func getMainAppFlags() []cli.Flag {
return []cli.Flag{}
}
6 changes: 3 additions & 3 deletions cmd/podman/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ var (
stores = make(map[storage.Store]struct{})
LatestFlag = cli.BoolFlag{
Name: "latest, l",
Usage: "act on the latest container podman is aware of",
Usage: "Act on the latest container podman is aware of",
}
LatestPodFlag = cli.BoolFlag{
Name: "latest, l",
Usage: "act on the latest pod podman is aware of",
Usage: "Act on the latest pod podman is aware of",
}
WorkDirFlag = cli.StringFlag{
Name: "workdir, w",
Expand Down Expand Up @@ -213,7 +213,7 @@ var createFlags = []cli.Flag{
},
cli.StringFlag{
Name: "conmon-pidfile",
Usage: "path to the file that will receive the PID of conmon",
Usage: "Path to the file that will receive the PID of conmon",
},
cli.Uint64Flag{
Name: "cpu-period",
Expand Down
37 changes: 20 additions & 17 deletions cmd/podman/containers_prune.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package main

import (
"github.com/containers/libpod/cmd/podman/libpodruntime"
"context"

"github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/libpod/adapter"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
Expand All @@ -25,20 +27,11 @@ var (
}
)

func pruneContainersCmd(c *cli.Context) error {
var (
deleteFuncs []shared.ParallelWorkerInput
)

ctx := getContext()
runtime, err := libpodruntime.GetRuntime(c)
if err != nil {
return errors.Wrapf(err, "could not get runtime")
}
defer runtime.Shutdown(false)
func pruneContainers(runtime *adapter.LocalRuntime, ctx context.Context, maxWorkers int, force bool) error {
var deleteFuncs []shared.ParallelWorkerInput

filter := func(c *libpod.Container) bool {
state, _ := c.State()
state, err := c.State()
if state == libpod.ContainerStateStopped || (state == libpod.ContainerStateExited && err == nil && c.PodID() == "") {
return true
}
Expand All @@ -54,21 +47,31 @@ func pruneContainersCmd(c *cli.Context) error {
for _, container := range delContainers {
con := container
f := func() error {
return runtime.RemoveContainer(ctx, con, c.Bool("force"))
return runtime.RemoveContainer(ctx, con, force)
}

deleteFuncs = append(deleteFuncs, shared.ParallelWorkerInput{
ContainerID: con.ID(),
ParallelFunc: f,
})
}
// Run the parallel funcs
deleteErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, deleteFuncs)
return printParallelOutput(deleteErrors, errCount)
}

func pruneContainersCmd(c *cli.Context) error {
runtime, err := adapter.GetRuntime(c)
if err != nil {
return errors.Wrapf(err, "could not get runtime")
}
defer runtime.Shutdown(false)

maxWorkers := shared.Parallelize("rm")
if c.GlobalIsSet("max-workers") {
maxWorkers = c.GlobalInt("max-workers")
}
logrus.Debugf("Setting maximum workers to %d", maxWorkers)

// Run the parallel funcs
deleteErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, deleteFuncs)
return printParallelOutput(deleteErrors, errCount)
return pruneContainers(runtime, getContext(), maxWorkers, c.Bool("force"))
}
4 changes: 2 additions & 2 deletions cmd/podman/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ var (
containerKubeCommand,
}

generateDescription = "generate structured data based for a containers and pods"
generateDescription = "Generate structured data based for a containers and pods"
kubeCommand = cli.Command{
Name: "generate",
Usage: "generated structured data",
Usage: "Generate structured data",
Description: generateDescription,
ArgsUsage: "",
Subcommands: generateSubCommands,
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/generate_kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
containerKubeFlags = []cli.Flag{
cli.BoolFlag{
Name: "service, s",
Usage: "generate YAML for kubernetes service object",
Usage: "Generate YAML for kubernetes service object",
},
}
containerKubeDescription = "Generate Kubernetes Pod YAML"
Expand Down
14 changes: 7 additions & 7 deletions cmd/podman/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,32 +90,32 @@ var (
},
cli.BoolFlag{
Name: "digests",
Usage: "show digests",
Usage: "Show digests",
},
cli.StringSliceFlag{
Name: "filter, f",
Usage: "filter output based on conditions provided (default [])",
Usage: "Filter output based on conditions provided (default [])",
},
cli.StringFlag{
Name: "format",
Usage: "Change the output format to JSON or a Go template",
},
cli.BoolFlag{
Name: "noheading, n",
Usage: "do not print column headings",
Usage: "Do not print column headings",
},
cli.BoolFlag{
Name: "no-trunc, notruncate",
Usage: "do not truncate output",
Usage: "Do not truncate output",
},
cli.BoolFlag{
Name: "quiet, q",
Usage: "display only image IDs",
Usage: "Display only image IDs",
},
cli.StringFlag{
Name: "sort",
Usage: "Sort by created, id, repository, size, or tag",
Value: "created",
Value: "Created",
},
}

Expand All @@ -133,7 +133,7 @@ var (
lsImagesCommand = cli.Command{
Name: "list",
Aliases: []string{"ls"},
Usage: "list images in local storage",
Usage: "List images in local storage",
Description: imagesDescription,
Flags: imagesFlags,
Action: imagesCmd,
Expand Down
3 changes: 2 additions & 1 deletion cmd/podman/images_prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"

"github.com/containers/libpod/libpod/adapter"
"github.com/pkg/errors"
"github.com/urfave/cli"
Expand All @@ -16,7 +17,7 @@ var (
pruneImageFlags = []cli.Flag{
cli.BoolFlag{
Name: "all, a",
Usage: "remove all unused images, not just dangling ones",
Usage: "Remove all unused images, not just dangling ones",
},
}
pruneImagesCommand = cli.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
infoFlags = []cli.Flag{
cli.BoolFlag{
Name: "debug, D",
Usage: "display additional debug information",
Usage: "Display additional debug information",
},
cli.StringFlag{
Name: "format, f",
Expand Down
9 changes: 5 additions & 4 deletions cmd/podman/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func main() {
inspectCommand,
pullCommand,
rmiCommand,
systemCommand,
tagCommand,
versionCommand,
}
Expand Down Expand Up @@ -187,21 +188,21 @@ func main() {
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config, c",
Usage: "path of a libpod config file detailing container server configuration options",
Usage: "Path of a libpod config file detailing container server configuration options",
Hidden: true,
},
cli.StringFlag{
Name: "cpu-profile",
Usage: "path for the cpu profiling results",
Usage: "Path for the cpu profiling results",
},
cli.StringFlag{
Name: "log-level",
Usage: "log messages above specified level: debug, info, warn, error (default), fatal or panic",
Usage: "Log messages above specified level: debug, info, warn, error (default), fatal or panic",
Value: "error",
},
cli.StringFlag{
Name: "tmpdir",
Usage: "path to the tmp directory",
Usage: "Path to the tmp directory",
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var (
},
cli.BoolFlag{
Name: "notruncate",
Usage: "do not truncate output",
Usage: "Do not truncate output",
},
LatestFlag,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pause.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
pauseFlags = []cli.Flag{
cli.BoolFlag{
Name: "all, a",
Usage: "pause all running containers",
Usage: "Pause all running containers",
},
}
pauseDescription = `
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/play.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var (
playDescription = "Play a pod and its containers from a structured file."
playCommand = cli.Command{
Name: "play",
Usage: "play a container or pod",
Usage: "Play a container or pod",
Description: playDescription,
ArgsUsage: "",
Subcommands: playSubCommands,
Expand Down
Loading