aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/attach.go2
-rw-r--r--cmd/podman/checkpoint.go2
-rw-r--r--cmd/podman/cleanup.go2
-rw-r--r--cmd/podman/cliconfig/config.go18
-rw-r--r--cmd/podman/common.go37
-rw-r--r--cmd/podman/cp.go2
-rw-r--r--cmd/podman/init.go2
-rw-r--r--cmd/podman/kill.go2
-rw-r--r--cmd/podman/libpodruntime/runtime.go2
-rw-r--r--cmd/podman/main_local.go2
-rw-r--r--cmd/podman/mount.go2
-rw-r--r--cmd/podman/pod_kill.go2
-rw-r--r--cmd/podman/pod_pause.go2
-rw-r--r--cmd/podman/pod_restart.go2
-rw-r--r--cmd/podman/pod_rm.go2
-rw-r--r--cmd/podman/pod_start.go2
-rw-r--r--cmd/podman/pod_stop.go2
-rw-r--r--cmd/podman/pod_unpause.go2
-rw-r--r--cmd/podman/port.go2
-rw-r--r--cmd/podman/remoteclientconfig/configfile_test.go2
-rw-r--r--cmd/podman/restart.go2
-rw-r--r--cmd/podman/restore.go2
-rw-r--r--cmd/podman/rm.go8
-rw-r--r--cmd/podman/shared/container.go4
-rw-r--r--cmd/podman/shared/create.go52
-rw-r--r--cmd/podman/shared/parallel.go2
-rw-r--r--cmd/podman/shared/parse/parse_test.go4
-rw-r--r--cmd/podman/shared/workers.go2
-rw-r--r--cmd/podman/stats.go2
-rw-r--r--cmd/podman/stop.go4
-rw-r--r--cmd/podman/tree.go2
-rw-r--r--cmd/podman/umount.go2
32 files changed, 117 insertions, 60 deletions
diff --git a/cmd/podman/attach.go b/cmd/podman/attach.go
index b03673f29..eeedea8c8 100644
--- a/cmd/podman/attach.go
+++ b/cmd/podman/attach.go
@@ -37,7 +37,7 @@ func init() {
flags.BoolVar(&attachCommand.SigProxy, "sig-proxy", true, "Proxy received signals to the process")
flags.BoolVarP(&attachCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
markFlagHiddenForRemoteClient("latest", flags)
- // TODO allow for passing of a new deatch keys
+ // TODO allow for passing of a new detach keys
markFlagHiddenForRemoteClient("detach-keys", flags)
}
diff --git a/cmd/podman/checkpoint.go b/cmd/podman/checkpoint.go
index 22cdb1f39..07db519f8 100644
--- a/cmd/podman/checkpoint.go
+++ b/cmd/podman/checkpoint.go
@@ -26,7 +26,7 @@ var (
return checkpointCmd(&checkpointCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman container checkpoint --keep ctrID
podman container checkpoint --all
diff --git a/cmd/podman/cleanup.go b/cmd/podman/cleanup.go
index c00654162..a8bc0c116 100644
--- a/cmd/podman/cleanup.go
+++ b/cmd/podman/cleanup.go
@@ -27,7 +27,7 @@ var (
return cleanupCmd(&cleanupCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman container cleanup --latest
podman container cleanup ctrID1 ctrID2 ctrID3
diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go
index 158306ccc..745f49651 100644
--- a/cmd/podman/cliconfig/config.go
+++ b/cmd/podman/cliconfig/config.go
@@ -482,11 +482,12 @@ type RestoreValues struct {
type RmValues struct {
PodmanCommand
- All bool
- Force bool
- Latest bool
- Storage bool
- Volumes bool
+ All bool
+ Force bool
+ Latest bool
+ Storage bool
+ Volumes bool
+ CIDFiles []string
}
type RmiValues struct {
@@ -559,9 +560,10 @@ type StatsValues struct {
type StopValues struct {
PodmanCommand
- All bool
- Latest bool
- Timeout uint
+ All bool
+ Latest bool
+ Timeout uint
+ CIDFiles []string
}
type TopValues struct {
diff --git a/cmd/podman/common.go b/cmd/podman/common.go
index 4db043f31..442823d2d 100644
--- a/cmd/podman/common.go
+++ b/cmd/podman/common.go
@@ -39,24 +39,45 @@ func shortID(id string) string {
return id
}
-// checkAllAndLatest checks that --all and --latest are used correctly
-func checkAllAndLatest(c *cobra.Command, args []string, ignoreArgLen bool) error {
+// checkAllLatestAndCIDFile checks that --all and --latest are used correctly.
+// If cidfile is set, also check for the --cidfile flag.
+func checkAllLatestAndCIDFile(c *cobra.Command, args []string, ignoreArgLen bool, cidfile bool) error {
argLen := len(args)
if c.Flags().Lookup("all") == nil || c.Flags().Lookup("latest") == nil {
- return errors.New("unable to lookup values for 'latest' or 'all'")
+ if !cidfile {
+ return errors.New("unable to lookup values for 'latest' or 'all'")
+ } else if c.Flags().Lookup("cidfile") == nil {
+ return errors.New("unable to lookup values for 'latest', 'all' or 'cidfile'")
+ }
+ }
+
+ specifiedAll, _ := c.Flags().GetBool("all")
+ specifiedLatest, _ := c.Flags().GetBool("latest")
+ specifiedCIDFile := false
+ if cid, _ := c.Flags().GetStringArray("cidfile"); len(cid) > 0 {
+ specifiedCIDFile = true
}
- all, _ := c.Flags().GetBool("all")
- latest, _ := c.Flags().GetBool("latest")
- if all && latest {
+
+ if specifiedCIDFile && (specifiedAll || specifiedLatest) {
+ return errors.Errorf("--all, --latest and --cidfile cannot be used together")
+ } else if specifiedAll && specifiedLatest {
return errors.Errorf("--all and --latest cannot be used together")
}
+
if ignoreArgLen {
return nil
}
- if (all || latest) && argLen > 0 {
+ if (argLen > 0) && (specifiedAll || specifiedLatest) {
return errors.Errorf("no arguments are needed with --all or --latest")
+ } else if cidfile && (argLen > 0) && (specifiedAll || specifiedLatest || specifiedCIDFile) {
+ return errors.Errorf("no arguments are needed with --all, --latest or --cidfile")
}
- if argLen < 1 && !all && !latest {
+
+ if specifiedCIDFile {
+ return nil
+ }
+
+ if argLen < 1 && !specifiedAll && !specifiedLatest && !specifiedCIDFile {
return errors.Errorf("you must provide at least one name or id")
}
return nil
diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go
index c53a97df3..762d70252 100644
--- a/cmd/podman/cp.go
+++ b/cmd/podman/cp.go
@@ -192,7 +192,7 @@ func copyBetweenHostAndContainer(runtime *libpod.Runtime, src string, dest strin
} else if isBindMount, mount := isBindMountDestName(srcPath, ctr); isBindMount {
path, err := pathWithBindMountSource(mount, srcPath)
if err != nil {
- return errors.Wrapf(err, "error getting source path from bind moutn %s", mount.Destination)
+ return errors.Wrapf(err, "error getting source path from bind mount %s", mount.Destination)
}
srcPath = path
} else if filepath.IsAbs(srcPath) {
diff --git a/cmd/podman/init.go b/cmd/podman/init.go
index 3f97824fc..2e0b33828 100644
--- a/cmd/podman/init.go
+++ b/cmd/podman/init.go
@@ -23,7 +23,7 @@ var (
return initCmd(&initCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman init --latest
podman init 3c45ef19d893
diff --git a/cmd/podman/kill.go b/cmd/podman/kill.go
index d5056d86d..aba2008ca 100644
--- a/cmd/podman/kill.go
+++ b/cmd/podman/kill.go
@@ -24,7 +24,7 @@ var (
return killCmd(&killCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman kill mywebserver
podman kill 860a4b23
diff --git a/cmd/podman/libpodruntime/runtime.go b/cmd/podman/libpodruntime/runtime.go
index dd8c3f173..9425cfb9c 100644
--- a/cmd/podman/libpodruntime/runtime.go
+++ b/cmd/podman/libpodruntime/runtime.go
@@ -157,7 +157,7 @@ func getRuntime(ctx context.Context, c *cliconfig.PodmanCommand, renumber, migra
// TODO flag to set CNI plugins dir?
- // TODO I dont think these belong here?
+ // TODO I don't think these belong here?
// Will follow up with a different PR to address
//
// Pod create options
diff --git a/cmd/podman/main_local.go b/cmd/podman/main_local.go
index f630f1210..0484e3cf0 100644
--- a/cmd/podman/main_local.go
+++ b/cmd/podman/main_local.go
@@ -64,7 +64,7 @@ func init() {
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.Root, "root", "", "Path to the root directory in which data, including images, is stored")
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.Runroot, "runroot", "", "Path to the 'run directory' where all state information is stored")
rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.Runtime, "runtime", "", "Path to the OCI-compatible binary used to run containers, default is /usr/bin/runc")
- // -s is depracated due to conflict with -s on subcommands
+ // -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")
diff --git a/cmd/podman/mount.go b/cmd/podman/mount.go
index b14827592..526a236fd 100644
--- a/cmd/podman/mount.go
+++ b/cmd/podman/mount.go
@@ -35,7 +35,7 @@ var (
return mountCmd(&mountCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, true)
+ return checkAllLatestAndCIDFile(cmd, args, true, false)
},
}
)
diff --git a/cmd/podman/pod_kill.go b/cmd/podman/pod_kill.go
index 9bda77471..064946f72 100644
--- a/cmd/podman/pod_kill.go
+++ b/cmd/podman/pod_kill.go
@@ -28,7 +28,7 @@ var (
return podKillCmd(&podKillCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman pod kill podID
podman pod kill --signal TERM mywebserver
diff --git a/cmd/podman/pod_pause.go b/cmd/podman/pod_pause.go
index 45e1319ff..320072919 100644
--- a/cmd/podman/pod_pause.go
+++ b/cmd/podman/pod_pause.go
@@ -25,7 +25,7 @@ var (
return podPauseCmd(&podPauseCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman pod pause podID1 podID2
podman pod pause --latest
diff --git a/cmd/podman/pod_restart.go b/cmd/podman/pod_restart.go
index cc090bd6e..cb9f3770f 100644
--- a/cmd/podman/pod_restart.go
+++ b/cmd/podman/pod_restart.go
@@ -26,7 +26,7 @@ var (
return podRestartCmd(&podRestartCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman pod restart podID1 podID2
podman pod restart --latest
diff --git a/cmd/podman/pod_rm.go b/cmd/podman/pod_rm.go
index 82d0eb977..86d6d2f27 100644
--- a/cmd/podman/pod_rm.go
+++ b/cmd/podman/pod_rm.go
@@ -26,7 +26,7 @@ var (
return podRmCmd(&podRmCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman pod rm mywebserverpod
podman pod rm -f 860a4b23
diff --git a/cmd/podman/pod_start.go b/cmd/podman/pod_start.go
index 64c951b43..aa2e09e98 100644
--- a/cmd/podman/pod_start.go
+++ b/cmd/podman/pod_start.go
@@ -26,7 +26,7 @@ var (
return podStartCmd(&podStartCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman pod start podID
podman pod start --latest
diff --git a/cmd/podman/pod_stop.go b/cmd/podman/pod_stop.go
index edda99550..579e4f1d3 100644
--- a/cmd/podman/pod_stop.go
+++ b/cmd/podman/pod_stop.go
@@ -27,7 +27,7 @@ var (
return podStopCmd(&podStopCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman pod stop mywebserverpod
podman pod stop --latest
diff --git a/cmd/podman/pod_unpause.go b/cmd/podman/pod_unpause.go
index 833434c3f..1f80a7c79 100644
--- a/cmd/podman/pod_unpause.go
+++ b/cmd/podman/pod_unpause.go
@@ -26,7 +26,7 @@ var (
return podUnpauseCmd(&podUnpauseCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman pod unpause podID1 podID2
podman pod unpause --all
diff --git a/cmd/podman/port.go b/cmd/podman/port.go
index 4e1f9642c..eef3d4b1d 100644
--- a/cmd/podman/port.go
+++ b/cmd/podman/port.go
@@ -26,7 +26,7 @@ var (
return portCmd(&portCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, true)
+ return checkAllLatestAndCIDFile(cmd, args, true, false)
},
Example: `podman port --all
podman port ctrID 80/tcp
diff --git a/cmd/podman/remoteclientconfig/configfile_test.go b/cmd/podman/remoteclientconfig/configfile_test.go
index 0bcac29a8..1710ee83f 100644
--- a/cmd/podman/remoteclientconfig/configfile_test.go
+++ b/cmd/podman/remoteclientconfig/configfile_test.go
@@ -88,7 +88,7 @@ func TestReadRemoteConfig(t *testing.T) {
{"good", args{reader: strings.NewReader(goodConfig)}, makeGoodResult(), false},
// a connection with no destination is an error
{"nodest", args{reader: strings.NewReader(noDest)}, nil, true},
- // a connnection with no user is OK
+ // a connection with no user is OK
{"nouser", args{reader: strings.NewReader(noUser)}, makeNoUserResult(), false},
}
for _, tt := range tests {
diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go
index c97fb0dc1..996a9f7ce 100644
--- a/cmd/podman/restart.go
+++ b/cmd/podman/restart.go
@@ -23,7 +23,7 @@ var (
return restartCmd(&restartCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman restart ctrID
podman restart --latest
diff --git a/cmd/podman/restore.go b/cmd/podman/restore.go
index caefadb6d..a8db7fa94 100644
--- a/cmd/podman/restore.go
+++ b/cmd/podman/restore.go
@@ -26,7 +26,7 @@ var (
return restoreCmd(&restoreCommand, cmd)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, true)
+ return checkAllLatestAndCIDFile(cmd, args, true, false)
},
Example: `podman container restore ctrID
podman container restore --latest
diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go
index 6329a9d8e..b3bc8e1b9 100644
--- a/cmd/podman/rm.go
+++ b/cmd/podman/rm.go
@@ -25,7 +25,7 @@ var (
return rmCmd(&rmCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, true)
},
Example: `podman rm imageID
podman rm mywebserver myflaskserver 860a4b23
@@ -44,8 +44,10 @@ func init() {
flags.BoolVarP(&rmCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
flags.BoolVar(&rmCommand.Storage, "storage", false, "Remove container from storage library")
flags.BoolVarP(&rmCommand.Volumes, "volumes", "v", false, "Remove anonymous volumes associated with the container")
+ flags.StringArrayVarP(&rmCommand.CIDFiles, "cidfile", "", nil, "Read the container ID from the file")
markFlagHiddenForRemoteClient("storage", flags)
markFlagHiddenForRemoteClient("latest", flags)
+ markFlagHiddenForRemoteClient("cidfile", flags)
}
// rmCmd removes one or more containers
@@ -58,8 +60,8 @@ func rmCmd(c *cliconfig.RmValues) error {
// Storage conflicts with --all/--latest/--volumes
if c.Storage {
- if c.All || c.Latest || c.Volumes {
- return errors.Errorf("--storage conflicts with --volumes, --all, and --latest")
+ if c.All || c.Latest || c.Volumes || c.CIDFiles != nil {
+ return errors.Errorf("--storage conflicts with --volumes, --all, --latest and --cidfile")
}
}
diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go
index bc64d63a9..f49943477 100644
--- a/cmd/podman/shared/container.go
+++ b/cmd/podman/shared/container.go
@@ -453,7 +453,7 @@ func PBatch(containers []*libpod.Container, workers int, opts PsOptions) []PsCon
psResults := []PsContainerOutput{}
// If the number of containers in question is less than the number of
- // proposed parallel operations, we shouldnt spawn so many workers.
+ // proposed parallel operations, we shouldn't spawn so many workers.
if workers > len(containers) {
workers = len(containers)
}
@@ -694,7 +694,7 @@ func portsToString(ports []ocicni.PortMapping) string {
portgroup, ok := portGroupMap[portMapKey]
if !ok {
portGroupMap[portMapKey] = &portGroup{first: v.ContainerPort, last: v.ContainerPort}
- // This list is required to travese portGroupMap.
+ // This list is required to traverse portGroupMap.
groupKeyList = append(groupKeyList, portMapKey)
continue
}
diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go
index c7ea2e389..bb4e9cd12 100644
--- a/cmd/podman/shared/create.go
+++ b/cmd/podman/shared/create.go
@@ -7,6 +7,7 @@ import (
"io"
"os"
"path/filepath"
+ goruntime "runtime"
"strconv"
"strings"
"syscall"
@@ -88,9 +89,11 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.
return nil, nil, err
}
+ overrideOS := c.String("override-os")
+ overrideArch := c.String("override-arch")
dockerRegistryOptions := image.DockerRegistryOptions{
- OSChoice: c.String("override-os"),
- ArchitectureChoice: c.String("override-arch"),
+ OSChoice: overrideOS,
+ ArchitectureChoice: overrideArch,
}
newImage, err := runtime.ImageRuntime().New(ctx, name, rtc.SignaturePolicyPath, c.String("authfile"), writer, &dockerRegistryOptions, image.SigningOptions{}, nil, pullType)
@@ -101,6 +104,15 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.
if err != nil {
return nil, nil, err
}
+
+ if overrideOS == "" && data.Os != goruntime.GOOS {
+ return nil, nil, errors.Errorf("incompatible image OS %q on %q host", data.Os, goruntime.GOOS)
+ }
+
+ if overrideArch == "" && data.Architecture != goruntime.GOARCH {
+ return nil, nil, errors.Errorf("incompatible image architecture %q on %q host", data.Architecture, goruntime.GOARCH)
+ }
+
names := newImage.Names()
if len(names) > 0 {
imageName = names[0]
@@ -111,7 +123,7 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.
// if the user disabled the healthcheck with "none", we skip adding it
healthCheckCommandInput := c.String("healthcheck-command")
- // the user didnt disable the healthcheck but did pass in a healthcheck command
+ // the user didn't disable the healthcheck but did pass in a healthcheck command
// now we need to make a healthcheck from the commandline input
if healthCheckCommandInput != "none" {
if len(healthCheckCommandInput) > 0 {
@@ -214,24 +226,24 @@ func configureEntrypoint(c *GenericCLIResults, data *inspect.ImageData) []string
return entrypoint
}
-func configurePod(c *GenericCLIResults, runtime *libpod.Runtime, namespaces map[string]string, podName string) (map[string]string, error) {
+func configurePod(c *GenericCLIResults, runtime *libpod.Runtime, namespaces map[string]string, podName string) (map[string]string, string, error) {
pod, err := runtime.LookupPod(podName)
if err != nil {
- return namespaces, err
+ return namespaces, "", err
}
podInfraID, err := pod.InfraContainerID()
if err != nil {
- return namespaces, err
+ return namespaces, "", err
}
hasUserns := false
if podInfraID != "" {
podCtr, err := runtime.GetContainer(podInfraID)
if err != nil {
- return namespaces, err
+ return namespaces, "", err
}
mappings, err := podCtr.IDMappings()
if err != nil {
- return namespaces, err
+ return namespaces, "", err
}
hasUserns = len(mappings.UIDMap) > 0
}
@@ -251,7 +263,7 @@ func configurePod(c *GenericCLIResults, runtime *libpod.Runtime, namespaces map[
if (namespaces["uts"] == cc.Pod) || (!c.IsSet("uts") && pod.SharesUTS()) {
namespaces["uts"] = fmt.Sprintf("container:%s", podInfraID)
}
- return namespaces, nil
+ return namespaces, podInfraID, nil
}
// Parses CLI options related to container creation into a config which can be
@@ -359,6 +371,10 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
if len(podName) < 1 && c.IsSet("pod") {
return nil, errors.Errorf("new pod name must be at least one character")
}
+
+ // If we are adding a container to a pod, we would like to add an annotation for the infra ID
+ // so kata containers can share VMs inside the pod
+ var podInfraID string
if c.IsSet("pod") {
if strings.HasPrefix(originalPodName, "new:") {
// pod does not exist; lets make it
@@ -387,7 +403,7 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
// The container now cannot have port bindings; so we reset the map
portBindings = make(map[nat.Port][]nat.PortBinding)
}
- namespaces, err = configurePod(c, runtime, namespaces, podName)
+ namespaces, podInfraID, err = configurePod(c, runtime, namespaces, podName)
if err != nil {
return nil, err
}
@@ -485,12 +501,26 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
// ANNOTATIONS
annotations := make(map[string]string)
+
// First, add our default annotations
- annotations[ann.ContainerType] = "sandbox"
annotations[ann.TTY] = "false"
if tty {
annotations[ann.TTY] = "true"
}
+
+ // in the event this container is in a pod, and the pod has an infra container
+ // we will want to configure it as a type "container" instead defaulting to
+ // the behavior of a "sandbox" container
+ // In Kata containers:
+ // - "sandbox" is the annotation that denotes the container should use its own
+ // VM, which is the default behavior
+ // - "container" denotes the container should join the VM of the SandboxID
+ // (the infra container)
+ if podInfraID != "" {
+ annotations[ann.SandboxID] = podInfraID
+ annotations[ann.ContainerType] = ann.ContainerTypeContainer
+ }
+
if data != nil {
// Next, add annotations from the image
for key, value := range data.Annotations {
diff --git a/cmd/podman/shared/parallel.go b/cmd/podman/shared/parallel.go
index e6ce50f95..eb1d40073 100644
--- a/cmd/podman/shared/parallel.go
+++ b/cmd/podman/shared/parallel.go
@@ -72,7 +72,7 @@ func ParallelExecuteWorkerPool(workers int, functions []ParallelWorkerInput) (ma
}
// Parallelize provides the maximum number of parallel workers (int) as calculated by a basic
-// heuristic. This can be overriden by the --max-workers primary switch to podman.
+// heuristic. This can be overridden by the --max-workers primary switch to podman.
func Parallelize(job string) int {
numCpus := runtime.NumCPU()
switch job {
diff --git a/cmd/podman/shared/parse/parse_test.go b/cmd/podman/shared/parse/parse_test.go
index 0a221c244..1359076a0 100644
--- a/cmd/podman/shared/parse/parse_test.go
+++ b/cmd/podman/shared/parse/parse_test.go
@@ -82,8 +82,8 @@ func TestValidateFileName(t *testing.T) {
args args
wantErr bool
}{
- {name: "good", args: args{filename: "/som/rand/path"}, wantErr: false},
- {name: "good", args: args{filename: "som/rand/path"}, wantErr: false},
+ {name: "good", args: args{filename: "/some/rand/path"}, wantErr: false},
+ {name: "good", args: args{filename: "some/rand/path"}, wantErr: false},
{name: "good", args: args{filename: "/"}, wantErr: false},
{name: "bad", args: args{filename: "/:"}, wantErr: true},
{name: "bad", args: args{filename: ":/"}, wantErr: true},
diff --git a/cmd/podman/shared/workers.go b/cmd/podman/shared/workers.go
index b6e3f10e7..a9d6bb77e 100644
--- a/cmd/podman/shared/workers.go
+++ b/cmd/podman/shared/workers.go
@@ -106,7 +106,7 @@ func (p *Pool) newWorker(slot int) {
}
// DefaultPoolSize provides the maximum number of parallel workers (int) as calculated by a basic
-// heuristic. This can be overriden by the --max-workers primary switch to podman.
+// heuristic. This can be overridden by the --max-workers primary switch to podman.
func DefaultPoolSize(name string) int {
numCpus := runtime.NumCPU()
switch name {
diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go
index f8c476386..f53e09412 100644
--- a/cmd/podman/stats.go
+++ b/cmd/podman/stats.go
@@ -128,7 +128,7 @@ func statsCmd(c *cliconfig.StatsValues) error {
for _, ctr := range ctrs {
initialStats, err := ctr.GetContainerStats(&libpod.ContainerStats{})
if err != nil {
- // when doing "all", dont worry about containers that are not running
+ // when doing "all", don't worry about containers that are not running
cause := errors.Cause(err)
if c.All && (cause == define.ErrCtrRemoved || cause == define.ErrNoSuchCtr || cause == define.ErrCtrStateInvalid) {
continue
diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go
index e04d8a12b..acecb298e 100644
--- a/cmd/podman/stop.go
+++ b/cmd/podman/stop.go
@@ -25,7 +25,7 @@ var (
return stopCmd(&stopCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, true)
},
Example: `podman stop ctrID
podman stop --latest
@@ -42,7 +42,9 @@ func init() {
flags.BoolVarP(&stopCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
flags.UintVar(&stopCommand.Timeout, "time", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
flags.UintVarP(&stopCommand.Timeout, "timeout", "t", define.CtrRemoveTimeout, "Seconds to wait for stop before killing the container")
+ flags.StringArrayVarP(&stopCommand.CIDFiles, "cidfile", "", nil, "Read the container ID from the file")
markFlagHiddenForRemoteClient("latest", flags)
+ markFlagHiddenForRemoteClient("cidfile", flags)
}
// stopCmd stops a container or containers
diff --git a/cmd/podman/tree.go b/cmd/podman/tree.go
index 904a0d375..cb1b3fc9c 100644
--- a/cmd/podman/tree.go
+++ b/cmd/podman/tree.go
@@ -115,7 +115,7 @@ func printImageChildren(layerMap map[string]*image.LayerInfo, layerID string, pr
// add continueItem i.e. '|' for next iteration prefix
prefix = prefix + continueItem
} else if len(ll.ChildID) > 1 || len(ll.ChildID) == 0 {
- // The above condition ensure, alignment happens for node, which has more then 1 childern.
+ // The above condition ensure, alignment happens for node, which has more then 1 children.
// If node is last in printing hierarchy, it should not be printed as middleItem i.e. ├──
intend = lastItem
prefix = prefix + " "
diff --git a/cmd/podman/umount.go b/cmd/podman/umount.go
index c3d81d3a8..6ad485c2c 100644
--- a/cmd/podman/umount.go
+++ b/cmd/podman/umount.go
@@ -28,7 +28,7 @@ var (
return umountCmd(&umountCommand)
},
Args: func(cmd *cobra.Command, args []string) error {
- return checkAllAndLatest(cmd, args, false)
+ return checkAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman umount ctrID
podman umount ctrID1 ctrID2 ctrID3