summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/build.go2
-rw-r--r--cmd/podman/cleanup.go1
-rw-r--r--cmd/podman/cliconfig/config.go7
-rw-r--r--cmd/podman/diff.go1
-rw-r--r--cmd/podman/images.go2
-rw-r--r--cmd/podman/load.go3
-rw-r--r--cmd/podman/main.go1
-rw-r--r--cmd/podman/main_local.go5
-rw-r--r--cmd/podman/network_list.go1
-rw-r--r--cmd/podman/pod_pause.go1
-rw-r--r--cmd/podman/pod_top.go2
-rw-r--r--cmd/podman/remoteclientconfig/config_darwin.go2
-rw-r--r--cmd/podman/remoteclientconfig/config_linux.go2
-rw-r--r--cmd/podman/remoteclientconfig/config_windows.go2
-rw-r--r--cmd/podman/run.go10
-rw-r--r--cmd/podman/runlabel.go2
-rw-r--r--cmd/podman/shared/create.go10
-rw-r--r--cmd/podman/sign.go4
18 files changed, 40 insertions, 18 deletions
diff --git a/cmd/podman/build.go b/cmd/podman/build.go
index b8b315c68..acd402fdd 100644
--- a/cmd/podman/build.go
+++ b/cmd/podman/build.go
@@ -342,6 +342,7 @@ func buildCmd(c *cliconfig.BuildValues) error {
}
options := imagebuildah.BuildOptions{
+ Architecture: c.Arch,
CommonBuildOpts: &buildOpts,
AdditionalTags: tags,
Annotations: c.Annotation,
@@ -359,6 +360,7 @@ func buildCmd(c *cliconfig.BuildValues) error {
Layers: layers,
NamespaceOptions: nsValues,
NoCache: c.NoCache,
+ OS: c.OS,
Out: stdout,
Output: output,
OutputFormat: format,
diff --git a/cmd/podman/cleanup.go b/cmd/podman/cleanup.go
index a8bc0c116..80a19b000 100644
--- a/cmd/podman/cleanup.go
+++ b/cmd/podman/cleanup.go
@@ -44,6 +44,7 @@ func init() {
flags.BoolVarP(&cleanupCommand.All, "all", "a", false, "Cleans up all containers")
flags.BoolVarP(&cleanupCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
flags.BoolVar(&cleanupCommand.Remove, "rm", false, "After cleanup, remove the container entirely")
+ flags.BoolVar(&cleanupCommand.RemoveImage, "rmi", false, "After cleanup, remove the image entirely")
markFlagHiddenForRemoteClient("latest", flags)
}
diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go
index ccc30c603..79917946a 100644
--- a/cmd/podman/cliconfig/config.go
+++ b/cmd/podman/cliconfig/config.go
@@ -658,9 +658,10 @@ type VolumeRmValues struct {
type CleanupValues struct {
PodmanCommand
- All bool
- Latest bool
- Remove bool
+ All bool
+ Latest bool
+ Remove bool
+ RemoveImage bool
}
type SystemPruneValues struct {
diff --git a/cmd/podman/diff.go b/cmd/podman/diff.go
index f052b510d..c15512360 100644
--- a/cmd/podman/diff.go
+++ b/cmd/podman/diff.go
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+
"github.com/containers/buildah/pkg/formats"
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/pkg/adapter"
diff --git a/cmd/podman/images.go b/cmd/podman/images.go
index de61690ae..41790a5aa 100644
--- a/cmd/podman/images.go
+++ b/cmd/podman/images.go
@@ -155,7 +155,7 @@ func imagesCmd(c *cliconfig.ImagesValues) error {
return errors.New("can not specify an image and a filter")
}
filters := c.Filter
- if len(filters) < 1 {
+ if len(filters) < 1 && len(image) > 0 {
filters = append(filters, fmt.Sprintf("reference=%s", image))
}
diff --git a/cmd/podman/load.go b/cmd/podman/load.go
index ed6a4e5fa..318b5b5fb 100644
--- a/cmd/podman/load.go
+++ b/cmd/podman/load.go
@@ -10,6 +10,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared/parse"
"github.com/containers/libpod/pkg/adapter"
+ "github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"
@@ -75,7 +76,7 @@ func loadCmd(c *cliconfig.LoadValues) error {
if terminal.IsTerminal(int(os.Stdin.Fd())) {
return errors.Errorf("cannot read from terminal. Use command-line redirection or the --input flag.")
}
- outFile, err := ioutil.TempFile("/var/tmp", "podman")
+ outFile, err := ioutil.TempFile(util.Tmpdir(), "podman")
if err != nil {
return errors.Errorf("error creating file %v", err)
}
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index 3320ab72f..a2acbbf53 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -138,6 +138,7 @@ func before(cmd *cobra.Command, args []string) error {
logrus.Info("running as rootless")
}
setUMask()
+
return profileOn(cmd)
}
diff --git a/cmd/podman/main_local.go b/cmd/podman/main_local.go
index e5b87754b..79b5e5af7 100644
--- a/cmd/podman/main_local.go
+++ b/cmd/podman/main_local.go
@@ -67,10 +67,11 @@ func init() {
// -s is deprecated due to conflict with -s on subcommands
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.StorageDriver, "storage-driver", "", "Select which storage driver is used to manage storage of images and containers (default is overlay)")
rootCmd.PersistentFlags().StringArrayVar(&MainGlobalOpts.StorageOpts, "storage-opt", []string{}, "Used to pass an option to the storage driver")
- rootCmd.PersistentFlags().BoolVar(&MainGlobalOpts.Syslog, "syslog", false, "Output logging information to syslog as well as the console")
+ rootCmd.PersistentFlags().BoolVar(&MainGlobalOpts.Syslog, "syslog", false, "Output logging information to syslog as well as the console (default false)")
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.TmpDir, "tmpdir", "", "Path to the tmp directory for libpod state content.\n\nNote: use the environment variable 'TMPDIR' to change the temporary storage location for container images, '/var/tmp'.\n")
- rootCmd.PersistentFlags().BoolVar(&MainGlobalOpts.Trace, "trace", false, "Enable opentracing output")
+ rootCmd.PersistentFlags().BoolVar(&MainGlobalOpts.Trace, "trace", false, "Enable opentracing output (default false)")
+ markFlagHidden(rootCmd.PersistentFlags(), "trace")
}
func setSyslog() error {
diff --git a/cmd/podman/network_list.go b/cmd/podman/network_list.go
index 16edf743b..4f2380067 100644
--- a/cmd/podman/network_list.go
+++ b/cmd/podman/network_list.go
@@ -4,6 +4,7 @@ package main
import (
"errors"
+
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/pkg/rootless"
diff --git a/cmd/podman/pod_pause.go b/cmd/podman/pod_pause.go
index 320072919..24fcee6b9 100644
--- a/cmd/podman/pod_pause.go
+++ b/cmd/podman/pod_pause.go
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
diff --git a/cmd/podman/pod_top.go b/cmd/podman/pod_top.go
index fcd9c4f3c..734472817 100644
--- a/cmd/podman/pod_top.go
+++ b/cmd/podman/pod_top.go
@@ -42,7 +42,7 @@ func init() {
podTopCommand.SetHelpTemplate(HelpTemplate())
podTopCommand.SetUsageTemplate(UsageTemplate())
flags := podTopCommand.Flags()
- flags.BoolVarP(&podTopCommand.Latest, "latest,", "l", false, "Act on the latest pod podman is aware of")
+ flags.BoolVarP(&podTopCommand.Latest, "latest", "l", false, "Act on the latest pod podman is aware of")
flags.BoolVar(&podTopCommand.ListDescriptors, "list-descriptors", false, "")
markFlagHidden(flags, "list-descriptors")
}
diff --git a/cmd/podman/remoteclientconfig/config_darwin.go b/cmd/podman/remoteclientconfig/config_darwin.go
index b94941381..dddb217ac 100644
--- a/cmd/podman/remoteclientconfig/config_darwin.go
+++ b/cmd/podman/remoteclientconfig/config_darwin.go
@@ -3,7 +3,7 @@ package remoteclientconfig
import (
"path/filepath"
- "github.com/docker/docker/pkg/homedir"
+ "github.com/containers/storage/pkg/homedir"
)
func getConfigFilePath() string {
diff --git a/cmd/podman/remoteclientconfig/config_linux.go b/cmd/podman/remoteclientconfig/config_linux.go
index 5d27f19f2..afcf73e6d 100644
--- a/cmd/podman/remoteclientconfig/config_linux.go
+++ b/cmd/podman/remoteclientconfig/config_linux.go
@@ -4,7 +4,7 @@ import (
"os"
"path/filepath"
- "github.com/docker/docker/pkg/homedir"
+ "github.com/containers/storage/pkg/homedir"
)
func getConfigFilePath() string {
diff --git a/cmd/podman/remoteclientconfig/config_windows.go b/cmd/podman/remoteclientconfig/config_windows.go
index fa6ffca63..3a8f3bc7a 100644
--- a/cmd/podman/remoteclientconfig/config_windows.go
+++ b/cmd/podman/remoteclientconfig/config_windows.go
@@ -3,7 +3,7 @@ package remoteclientconfig
import (
"path/filepath"
- "github.com/docker/docker/pkg/homedir"
+ "github.com/containers/storage/pkg/homedir"
)
func getConfigFilePath() string {
diff --git a/cmd/podman/run.go b/cmd/podman/run.go
index 219f057c3..27247c5b5 100644
--- a/cmd/podman/run.go
+++ b/cmd/podman/run.go
@@ -7,6 +7,7 @@ import (
"github.com/containers/libpod/pkg/adapter"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -38,6 +39,7 @@ func init() {
flags.SetInterspersed(false)
flags.SetNormalizeFunc(aliasFlags)
flags.Bool("sig-proxy", true, "Proxy received signals to the process")
+ flags.Bool("rmi", false, "Remove container image unless used by other containers")
flags.AddFlagSet(getNetFlags())
getCreateFlags(&runCommand.PodmanCommand)
markFlagHiddenForRemoteClient("authfile", flags)
@@ -64,5 +66,13 @@ func runCmd(c *cliconfig.RunValues) error {
defer runtime.DeferredShutdown(false)
exitCode, err = runtime.Run(getContext(), c, exitCode)
+ if c.Bool("rmi") {
+ imageName := c.InputArgs[0]
+ if newImage, newImageErr := runtime.NewImageFromLocal(imageName); newImageErr != nil {
+ logrus.Errorf("%s", errors.Wrapf(newImageErr, "failed creating image object"))
+ } else if _, errImage := runtime.RemoveImage(getContext(), newImage, false); errImage != nil {
+ logrus.Errorf("%s", errors.Wrapf(errImage, "failed removing image"))
+ }
+ }
return err
}
diff --git a/cmd/podman/runlabel.go b/cmd/podman/runlabel.go
index 358538155..1ec4da650 100644
--- a/cmd/podman/runlabel.go
+++ b/cmd/podman/runlabel.go
@@ -49,7 +49,7 @@ func init() {
flags.StringVar(&runlabelCommand.Creds, "creds", "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
flags.BoolVar(&runlabelCommand.Display, "display", false, "Preview the command that the label would run")
flags.BoolVar(&runlabelCommand.Replace, "replace", false, "Replace existing container with a new one from the image")
- flags.StringVar(&runlabelCommand.Name, "name", "", "Assign a name to the container")
+ flags.StringVarP(&runlabelCommand.Name, "name", "n", "", "Assign a name to the container")
flags.StringVar(&runlabelCommand.Opt1, "opt1", "", "Optional parameter to pass for install")
flags.StringVar(&runlabelCommand.Opt2, "opt2", "", "Optional parameter to pass for install")
diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go
index 0ce578bef..8968f10e8 100644
--- a/cmd/podman/shared/create.go
+++ b/cmd/podman/shared/create.go
@@ -101,7 +101,7 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.
if err != nil {
return nil, nil, err
}
- imageData, err = newImage.Inspect(ctx)
+ imageData, err = newImage.InspectNoSize(ctx)
if err != nil {
return nil, nil, err
}
@@ -477,7 +477,9 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
//
// Precedence order (higher index wins):
// 1) env-host, 2) image data, 3) env-file, 4) env
- var env map[string]string
+ env := map[string]string{
+ "container": "podman",
+ }
// Start with env-host
if c.Bool("env-host") {
@@ -485,14 +487,14 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
if err != nil {
return nil, errors.Wrap(err, "error parsing host environment variables")
}
- env = osEnv
+ env = envLib.Join(env, osEnv)
}
// Image data overrides any previous variables
if data != nil {
configEnv, err := envLib.ParseSlice(data.Config.Env)
if err != nil {
- return nil, errors.Wrap(err, "error pasing image environment variables")
+ return nil, errors.Wrap(err, "error passing image environment variables")
}
env = envLib.Join(env, configEnv)
}
diff --git a/cmd/podman/sign.go b/cmd/podman/sign.go
index bc909b64e..8ac59b33b 100644
--- a/cmd/podman/sign.go
+++ b/cmd/podman/sign.go
@@ -35,8 +35,8 @@ var (
signCommand.Remote = remoteclient
return signCmd(&signCommand)
},
- Example: `podman sign --sign-by mykey imageID
- podman sign --sign-by mykey --directory ./mykeydir imageID`,
+ Example: `podman image sign --sign-by mykey imageID
+ podman image sign --sign-by mykey --directory ./mykeydir imageID`,
}
)