summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/containers/create.go58
-rw-r--r--cmd/podman/containers/stats.go16
-rw-r--r--docs/MANPAGE_SYNTAX.md41
-rw-r--r--docs/source/markdown/podman-attach.1.md13
-rw-r--r--docs/source/markdown/podman-auto-update.1.md5
-rw-r--r--docs/source/markdown/podman-commit.1.md14
-rw-r--r--docs/source/markdown/podman-completion.1.md3
-rw-r--r--docs/source/markdown/podman-container-checkpoint.1.md41
-rw-r--r--docs/source/markdown/podman-container-cleanup.1.md19
-rw-r--r--docs/source/markdown/podman-container-exists.1.md9
-rw-r--r--docs/source/markdown/podman-container-prune.1.md34
-rw-r--r--docs/source/markdown/podman-container-restore.1.md149
-rw-r--r--docs/source/markdown/podman-image-unmount.1.md2
-rw-r--r--docs/source/markdown/podman-image.1.md2
-rw-r--r--docs/source/markdown/podman-pull.1.md48
-rw-r--r--docs/source/markdown/podman-push.1.md43
-rw-r--r--go.mod2
-rw-r--r--go.sum5
-rw-r--r--libpod/define/containerstate.go10
-rw-r--r--libpod/stats.go10
-rw-r--r--pkg/api/handlers/compat/containers.go18
-rw-r--r--pkg/api/handlers/libpod/images_pull.go24
-rw-r--r--pkg/api/server/register_images.go4
-rw-r--r--pkg/bindings/images/pull.go10
-rw-r--r--pkg/bindings/images/types.go3
-rw-r--r--pkg/bindings/images/types_pull_options.go16
-rw-r--r--pkg/domain/infra/tunnel/images.go2
-rw-r--r--pkg/errorhandling/errorhandling.go9
-rw-r--r--pkg/specgen/generate/container.go3
-rw-r--r--pkg/specgen/generate/container_create.go3
-rw-r--r--test/apiv2/python/rest_api/test_v2_0_0_container.py23
-rw-r--r--test/e2e/stats_test.go11
-rw-r--r--test/system/255-auto-update.bats2
-rw-r--r--vendor/github.com/containers/common/libimage/image.go18
-rw-r--r--vendor/github.com/containers/common/libimage/pull.go48
-rw-r--r--vendor/github.com/containers/common/libimage/runtime.go56
-rw-r--r--vendor/github.com/containers/common/pkg/config/config.go2
-rw-r--r--vendor/github.com/containers/common/pkg/seccomp/default_linux.go42
-rw-r--r--vendor/github.com/containers/common/pkg/seccomp/seccomp.json50
-rw-r--r--vendor/github.com/containers/common/version/version.go2
-rw-r--r--vendor/modules.txt2
41 files changed, 505 insertions, 367 deletions
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go
index ecaef5c0a..1e11c53d5 100644
--- a/cmd/podman/containers/create.go
+++ b/cmd/podman/containers/create.go
@@ -8,7 +8,6 @@ import (
"strings"
"github.com/containers/common/pkg/config"
- storageTransport "github.com/containers/image/v5/storage"
"github.com/containers/image/v5/transports/alltransports"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
@@ -16,9 +15,7 @@ import (
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/specgen"
"github.com/containers/podman/v3/pkg/util"
- "github.com/containers/storage"
"github.com/pkg/errors"
- "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -235,30 +232,12 @@ func createInit(c *cobra.Command) error {
return nil
}
-// TODO: we should let the backend take care of the pull policy (which it
-// does!). The code below is at risk of causing regression and code divergence.
func pullImage(imageName string) (string, error) {
pullPolicy, err := config.ValidatePullPolicy(cliVals.Pull)
if err != nil {
return "", err
}
- // Check if the image is missing and hence if we need to pull it.
- imageMissing := true
- imageRef, err := alltransports.ParseImageName(imageName)
- switch {
- case err != nil:
- // Assume we specified a local image without the explicit storage transport.
- fallthrough
-
- case imageRef.Transport().Name() == storageTransport.Transport.Name():
- br, err := registry.ImageEngine().Exists(registry.GetContext(), imageName)
- if err != nil {
- return "", err
- }
- imageMissing = !br.Value
- }
-
if cliVals.Platform != "" || cliVals.Arch != "" || cliVals.OS != "" {
if cliVals.Platform != "" {
if cliVals.Arch != "" || cliVals.OS != "" {
@@ -270,31 +249,28 @@ func pullImage(imageName string) (string, error) {
cliVals.Arch = split[1]
}
}
+ }
- if pullPolicy != config.PullPolicyAlways {
- logrus.Info("--platform --arch and --os causes the pull policy to be \"always\"")
- pullPolicy = config.PullPolicyAlways
- }
+ pullReport, pullErr := registry.ImageEngine().Pull(registry.GetContext(), imageName, entities.ImagePullOptions{
+ Authfile: cliVals.Authfile,
+ Quiet: cliVals.Quiet,
+ Arch: cliVals.Arch,
+ OS: cliVals.OS,
+ Variant: cliVals.Variant,
+ SignaturePolicy: cliVals.SignaturePolicy,
+ PullPolicy: pullPolicy,
+ })
+ if pullErr != nil {
+ return "", pullErr
}
- if imageMissing || pullPolicy == config.PullPolicyAlways {
- if pullPolicy == config.PullPolicyNever {
- return "", errors.Wrap(storage.ErrImageUnknown, imageName)
- }
- pullReport, pullErr := registry.ImageEngine().Pull(registry.GetContext(), imageName, entities.ImagePullOptions{
- Authfile: cliVals.Authfile,
- Quiet: cliVals.Quiet,
- Arch: cliVals.Arch,
- OS: cliVals.OS,
- Variant: cliVals.Variant,
- SignaturePolicy: cliVals.SignaturePolicy,
- PullPolicy: pullPolicy,
- })
- if pullErr != nil {
- return "", pullErr
- }
+ // Return the input name such that the image resolves to correct
+ // repo/tag in the backend (see #8082). Unless we're referring to
+ // the image via a transport.
+ if _, err := alltransports.ParseImageName(imageName); err == nil {
imageName = pullReport.Images[0]
}
+
return imageName, nil
}
diff --git a/cmd/podman/containers/stats.go b/cmd/podman/containers/stats.go
index 27c5147a5..208d5d58f 100644
--- a/cmd/podman/containers/stats.go
+++ b/cmd/podman/containers/stats.go
@@ -143,7 +143,9 @@ func stats(cmd *cobra.Command, args []string) error {
func outputStats(reports []define.ContainerStats) error {
headers := report.Headers(define.ContainerStats{}, map[string]string{
"ID": "ID",
+ "UpTime": "CPU TIME",
"CPUPerc": "CPU %",
+ "AVGCPU": "Avg CPU %",
"MemUsage": "MEM USAGE / LIMIT",
"MemUsageBytes": "MEM USAGE / LIMIT",
"MemPerc": "MEM %",
@@ -163,7 +165,7 @@ func outputStats(reports []define.ContainerStats) error {
if report.IsJSON(statsOptions.Format) {
return outputJSON(stats)
}
- format := "{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDS}}\n"
+ format := "{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDS}}\t{{.UpTime}}\t{{.AVGCPU}}\n"
if len(statsOptions.Format) > 0 {
format = report.NormalizeFormat(statsOptions.Format)
}
@@ -203,6 +205,14 @@ func (s *containerStats) CPUPerc() string {
return floatToPercentString(s.CPU)
}
+func (s *containerStats) AVGCPU() string {
+ return floatToPercentString(s.AvgCPU)
+}
+
+func (s *containerStats) Up() string {
+ return (s.UpTime.String())
+}
+
func (s *containerStats) MemPerc() string {
return floatToPercentString(s.ContainerStats.MemPerc)
}
@@ -258,7 +268,9 @@ func outputJSON(stats []containerStats) error {
type jstat struct {
Id string `json:"id"` // nolint
Name string `json:"name"`
+ CPUTime string `json:"cpu_time"`
CpuPercent string `json:"cpu_percent"` // nolint
+ AverageCPU string `json:"avg_cpu"`
MemUsage string `json:"mem_usage"`
MemPerc string `json:"mem_percent"`
NetIO string `json:"net_io"`
@@ -270,7 +282,9 @@ func outputJSON(stats []containerStats) error {
jstats = append(jstats, jstat{
Id: j.ID(),
Name: j.Name,
+ CPUTime: j.Up(),
CpuPercent: j.CPUPerc(),
+ AverageCPU: j.AVGCPU(),
MemUsage: j.MemUsage(),
MemPerc: j.MemPerc(),
NetIO: j.NetIO(),
diff --git a/docs/MANPAGE_SYNTAX.md b/docs/MANPAGE_SYNTAX.md
index 9794a0c3d..553f5d977 100644
--- a/docs/MANPAGE_SYNTAX.md
+++ b/docs/MANPAGE_SYNTAX.md
@@ -4,7 +4,8 @@
podman\-command - short description
## SYNOPSIS
-(Shows the command structure. If the command can be written in two different ways, both of them have to be shown.)
+(Shows the command structure. If the command can be written in two different ways, both of them have to be shown.\
+Many manpages include the OPTIONS **--all**, **-a** and/or **--latest**, **-l**. In this case there is no `container name` or `ID` needed after the initial command. Because most of the other OPTIONS still need the `container name` or ` ID`, it is defined that the *container* argument in the command should **not** be put in brackets. It should also be noted in the *IMPORTANT* section in the description of the OPTION with the following sentence: *IMPORTANT: This OPTION does not need a container name or ID as input argument.*.)
**podman command** [*optional*] *mandatory value*
@@ -30,26 +31,36 @@ podman\-command - short description
## DESCRIPTION
**podman command** is always the beginning of the DESCRIPTION section. Putting the command as the first part of the DESCRIPTION ensures uniformity. All commands mentioned in the text retain their appearance and form.\
-Example sentence: The command **podman command** is an example command.
+Example for the first sentence: **podman command** is an example command.
Commands or files that are quoted from other podman manpages or podman repositories have to be linked to those. Non-podman commands are not to be linked.\
Example sentence: Use **[podman-run](podman-run.1.md)** or **[containers.conf(5)](https://github.com/containers/common/blob/master/docs/containers.conf.5.md)** for the problem.
-It should also be specified if the command can only be run as root. In addition, it should be described when a command, OPTION, or other content cannot be executed with the remote client or in combination with other commands, OPTIONS, or content. In this case, the following sentence is put at the end of a command, OPTION, or content: *IMPORTANT: This OPTION/command/other is not available with the command/OPTION/content/remote Podman client*. For a command, this should be done in the DESCRIPTION section. For the OPTIONS, it should be done in the DESCRIPTION of the specified OPTION. Do not use pronouns in the man pages, especially the word `you`.
+It should also be specified if the command can only be run as root. In addition, it should be described when a command, OPTION, or other content cannot be executed with the remote client or in combination with other commands, OPTIONS, or content. In this case, the following sentence is put at the end of a command, OPTION, or content: *IMPORTANT: This OPTION/command/other is not available with the command/OPTION/content/remote Podman client*. For a command, this should be done in the DESCRIPTION section. For the OPTIONS, it should be done in the DESCRIPTION of the specified OPTION.
+
+Do not use pronouns in the man pages, especially the word `you`.
+
+There should be **no** new line after H2-headers (`##`).
## OPTIONS
All flags are referred to as OPTIONS. The term flags should not be used. All OPTIONS are listed in this section. OPTIONS that appear in descriptions of other OPTIONS and sections retain their appearance, for example: **--exit**.
OPTIONS that are quoted from other podman manpages or podman repositories have to be linked to those.\
-Example sentence: Use **[podman-generate-systemd --new](podman-generate-systemd.1.md#--new)** for the problem.
+Example sentence: Use **[podman-generate-systemd --new](./source/markdown/podman-generate-systemd.1.md#--new)** for the problem.
+
+ Each OPTION should be explained to the fullest extent below the OPTION itself. Each OPTION is behind an H4-header (`####`). If the OPTION has a default argument, it has to be explained in the description of the OPTION. If the OPTION is also not available with a command/OPTION/content/remote Podman client, the sentence about the default argument should the second to last sentence. The sentence about the default argument should be in a new line as well as the *IMPORTANT* sentence.
+
+ All OPTIONS are to be sorted in alphabetical order.
- Each OPTION should be explained to the fullest extent below the OPTION itself. Each OPTION is behind an H4-header (`####`). If the OPTION has a default argument, it has to be explained in the description of the OPTION. If the OPTION is also not available with the remote client, the sentence about the default argument should the second to last sentence.
+ Tables should be used when there is a different definition for different arguments and these have to be explained. This is shown with the OPTION **--test**.\
+ Lists should be used when arguments are used that do not need a definition for each argument and a single description explains them. An example is shown with **[podman-commit --change](./source/markdown/podman-commit.1.md#--change--cinstruction)**
#### **--version**, **-v**
-OPTIONS can be put after the command in two different ways. Either the long version with **--option** or as the short version **-o**. If there are two ways to write an OPTION they are separated by a comma. If there are two versions of one command the long version is always shown in front.\
-Example: The default is **false**. *IMPORTANT: This OPTION is not available with the remote Podman client*.
+OPTIONS can be put after the command in two different ways. Either the long version with **--option** or as the short version **-o**. If there are two ways to write an OPTION they are separated by a comma. If there are two versions of one command the long version is always shown in front. If the arguments behind the OPTION are boolean, it is not shown behind the OPTION itself. The default boolean argument is shown in the same way normal default arguments are displayed.\
+Example: The default is **false**.\
+*IMPORTANT: This OPTION is not available with the remote Podman client.*
#### **--exit**
@@ -57,15 +68,17 @@ An example of an OPTION that has only one possible structure. Thus, it cannot be
#### **--answer**=, **-a**=**active** | *disable*
-The "answer" OPTION above is an example of an OPTION that accepts two possible arguments as inputs. If there is a default argument that is selected when the OPTION is not used in the command, it is shown in **bold**. If the OPTION is used it must include an argument afterwards. It must always be ensured that the standard argument is in the first position after the OPTION. In this example, there are two different ways to execute the command. Both possible OPTIONS have to be shown with the arguments following them. The default value is shown as **active**.
+The **--answer** OPTION above is an example of an OPTION that accepts two possible arguments as inputs. If there is a default argument that is selected when the OPTION is not used in the command, it is shown in **bold**. If the OPTION is used it must include an argument afterwards. It must always be ensured that the standard argument is in the first position after the OPTION. In this example, there are two different ways to execute the command. Both possible OPTIONS have to be shown with the arguments following them.\
+The default value is shown as **active**.
#### **--status**=**good** | *better* | *best*
-This is an example of three arguments following an OPTION. If the number of arguments is greater than three, the arguments are **not** listed after the equal sign. The arguments have to be shown in a table like in **--test**=**_test_**, regardless of the number of arguments. The default value is shown as **good**.
+This is an example of three arguments following an OPTION. If the number of arguments is greater than three, the arguments are **not** listed after the equal sign. The arguments have to be shown in a table like in **--test**=**_test_**. This form should also be used if the understanding of the content is in danger of becoming incomprehensible. An example for this is **[podman-container-prune --filters](./source/markdown/podman-container-prune.1.md#--filterfilters)**.\
+The default value is shown as **good**.
#### **--test**=**test**
-OPTIONS that are followed by an equal sign include an argument after the equal sign in **bold**. If there is a default argument, that is used if the OPTION is not specified in the command, the argument after the equal sign is displayed in **bold**. All arguments must be listed and explained in the text below the OPTION.
+OPTIONS that are followed by an equal sign include an argument after the equal sign in **bold** or *italic*. If there is a default argument, that is used if the OPTION is not specified in the command, the argument after the equal sign is displayed in **bold**. All arguments must be listed and explained in the text below the OPTION.
| Argument | Description |
| ------------------ | --------------------------------------------------------------------------- |
@@ -75,8 +88,8 @@ OPTIONS that are followed by an equal sign include an argument after the equal s
| *example four* | Example: Can be combined with **--exit**. |
| *example five* | The fifth description |
-The table shows an example for a listing of arguments. The contents in the table should be aligned left. If the content in the table conflicts with this, it can be aligned in a way that supports the understanding of the content. If there is a default argument, it **must** listed as the first entry in the table. The default value is shown as **example one**.
-
+The table shows an example for a listing of arguments. The contents in the table should be aligned left. If the content in the table conflicts with this, it can be aligned in a way that supports the understanding of the content. If there is a default argument, it **must** listed as the first entry in the table.\
+The default value is shown as **example one**.
If the number of arguments is smaller than four they have to be listed behind the OPTION as seen in the OPTION **--status**.
@@ -104,9 +117,7 @@ Description of the EXAMPLE
```
### Example comment
$ podman command
-
$ podman command -o
-
$ cat $HOME/Dockerfile | podman command --option
```
@@ -125,3 +136,5 @@ Normally, the dates of changes, the content of the changes and the person who pr
Example:\
December 2021, Originally compiled by Alexander Richter <example@redhat.com>
+
+`A new line is needed of the end of every manpage.`
diff --git a/docs/source/markdown/podman-attach.1.md b/docs/source/markdown/podman-attach.1.md
index 0a5948b4e..b86b981d2 100644
--- a/docs/source/markdown/podman-attach.1.md
+++ b/docs/source/markdown/podman-attach.1.md
@@ -15,11 +15,14 @@ The *container* can detached from (and leave it running) using a configurable ke
## OPTIONS
#### **--detach-keys**=**sequence**
-Specify the key **sequence** for detaching a *container*. Format is a single character `[a-Z]` or one or more `ctrl-<value>` characters where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`. Specifying "" will disable this feature. The default is `ctrl-p,ctrl-q`.
+Specify the key **sequence** for detaching a *container*. Format is a single character `[a-Z]` or one or more `ctrl-<value>` characters where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`. Specifying "" will disable this feature.\
+The default is `ctrl-p,ctrl-q`.
#### **--latest**, **-l**
-Instead of providing the *container name* or *ID*, use the last created *container*. If other methods are used than Podman to run containers such as `CRI-O`, the last started *container* could be from either of those methods. The default is **false**.\
-*IMPORTANT: This OPTION is not available with the remote Podman client.*
+
+Instead of providing the *container ID* or *name*, use the last created *container*. If other methods than Podman are used to run *containers* such as `CRI-O`, the last started *container* could be from either of those methods.\
+The default is **false**.\
+*IMPORTANT: This OPTION is not available with the remote Podman client. This OPTION does not need a container name or ID as input argument.*
#### **--no-stdin**
@@ -27,10 +30,10 @@ Do not attach STDIN. The default is **false**.
#### **--sig-proxy**
-Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied. The default is **true**.
+Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.\
+The default is **true**.
## EXAMPLES
-
Attach to a container called "foobar".
```
$ podman attach foobar
diff --git a/docs/source/markdown/podman-auto-update.1.md b/docs/source/markdown/podman-auto-update.1.md
index 52a9a3fec..24b910470 100644
--- a/docs/source/markdown/podman-auto-update.1.md
+++ b/docs/source/markdown/podman-auto-update.1.md
@@ -9,8 +9,7 @@ podman\-auto-update - Auto update containers according to their auto-update poli
## DESCRIPTION
**podman auto-update** looks up containers with a specified `io.containers.autoupdate` label (i.e., the auto-update policy).
-If the label is present and set to `registry`, Podman reaches out to the corresponding registry to check if the image has been updated.
-The label `image` is an alternative to `registry` maintained for backwards compatibility.
+If the label is present and set to `registry`, Podman reaches out to the corresponding registry to check if the image has been updated. The label `image` is an alternative to `registry` maintained for backwards compatibility.
An image is considered updated if the digest in the local storage is different than the one of the remote image.
If an image must be updated, Podman pulls it down and restarts the systemd unit executing the container.
@@ -35,7 +34,6 @@ Systemd units that start and stop a container cannot run a new image.
Podman ships with a `podman-auto-update.service` systemd unit. This unit is triggered daily at midnight by the `podman-auto-update.timer` systemd timer. The timer can be altered for custom time-based updates if desired. The unit can further be invoked by other systemd units (e.g., via the dependency tree) or manually via **systemctl start podman-auto-update.service**.
## OPTIONS
-
#### **--authfile**=*path*
Path of the authentication file. Default is `${XDG_RUNTIME_DIR}/containers/auth.json`, which is set using **[podman login](podman-login.1.md)**.
@@ -44,7 +42,6 @@ If the authorization state is not found there, `$HOME/.docker/config.json` is ch
Note: There is also the option to override the default path of the authentication file by setting the `REGISTRY_AUTH_FILE` environment variable. This can be done with **export REGISTRY_AUTH_FILE=_path_**.
## EXAMPLES
-
Autoupdate with registry policy
```
diff --git a/docs/source/markdown/podman-commit.1.md b/docs/source/markdown/podman-commit.1.md
index bb7d3ce70..87b7e8aea 100644
--- a/docs/source/markdown/podman-commit.1.md
+++ b/docs/source/markdown/podman-commit.1.md
@@ -15,7 +15,6 @@ If `image` does not begin with a registry name component, `localhost` will be ad
If `image` is not provided, the values for the `REPOSITORY` and `TAG` values of the created image will each be set to `<none>`.
## OPTIONS
-
#### **--author**, **-a**=*author*
Set the author for the committed image.
@@ -39,7 +38,8 @@ Can be set multiple times.
#### **--format**, **-f** =**oci** | *docker*
-Set the format of the image manifest and metadata. The currently supported formats are **oci** and *docker*. The default is **oci**.
+Set the format of the image manifest and metadata. The currently supported formats are **oci** and *docker*.\
+The default is **oci**.
#### **--iidfile**=*ImageIDfile*
@@ -47,7 +47,8 @@ Write the image ID to the file.
#### **--include-volumes**
-Include in the committed image any volumes added to the container by the **--volume** or **--mount** OPTIONS to the **[podman create](podman-create.1.md)** and **[podman run](podman-run.1.md)** commands. The default is **false**.
+Include in the committed image any volumes added to the container by the **--volume** or **--mount** OPTIONS to the **[podman create](podman-create.1.md)** and **[podman run](podman-run.1.md)** commands.\
+The default is **false**.
#### **--message**, **-m**=*message*
@@ -56,14 +57,15 @@ Set commit message for committed image.\
#### **--pause**, **-p**
-Pause the container when creating an image. The default is **false**.
+Pause the container when creating an image.\
+The default is **false**.
#### **--quiet**, **-q**
-Suppresses output. The default is **false**.
+Suppresses output.\
+The default is **false**.
## EXAMPLES
-
Create image from container with entrypoint and label
```
$ podman commit --change CMD=/bin/bash --change ENTRYPOINT=/bin/sh --change "LABEL blue=image" reverent_golick image-committed
diff --git a/docs/source/markdown/podman-completion.1.md b/docs/source/markdown/podman-completion.1.md
index f8589ce68..639332365 100644
--- a/docs/source/markdown/podman-completion.1.md
+++ b/docs/source/markdown/podman-completion.1.md
@@ -20,7 +20,8 @@ Write the generated output to a file.
#### **--no-desc**
-Do not provide description in the completions. The default is **false**.
+Do not provide description in the completions.\
+The default is **false**.
## Installation
diff --git a/docs/source/markdown/podman-container-checkpoint.1.md b/docs/source/markdown/podman-container-checkpoint.1.md
index a86389f59..56fd848ac 100644
--- a/docs/source/markdown/podman-container-checkpoint.1.md
+++ b/docs/source/markdown/podman-container-checkpoint.1.md
@@ -12,17 +12,19 @@ podman\-container\-checkpoint - Checkpoints one or more running containers
## OPTIONS
#### **--all**, **-a**
-Checkpoint all running *containers*. The default is **false**.
+Checkpoint all running *containers*.\
+The default is **false**.\
+*IMPORTANT: This OPTION does not need a container name or ID as input argument.*
#### **--compress**, **-c**=**zstd** | *none* | *gzip*
Specify the compression algorithm used for the checkpoint archive created
with the **--export, -e** OPTION. Possible algorithms are **zstd**, *none*
-and *gzip*. The default is **zstd**.
-
+and *gzip*.\
One possible reason to use *none* is to enable faster creation of checkpoint
archives. Not compressing the checkpoint archive can result in faster checkpoint
-archive creation.
+archive creation.\
+The default is **zstd**.
#### **--export**, **-e**=*archive*
@@ -33,50 +35,55 @@ root file-system, if not explicitly disabled using **--ignore-rootfs**.
#### **--ignore-rootfs**
-This only works in combination with **--export, -e**. If a checkpoint is
-exported to a tar.gz file it is possible with the help of **--ignore-rootfs**
-to explicitly disable including changes to the root file-system into
-the checkpoint archive file. The default is **false**.
+If a checkpoint is exported to a tar.gz file it is possible with the help of **--ignore-rootfs** to explicitly disable including changes to the root file-system into the checkpoint archive file.\
+The default is **false**.\
+*IMPORTANT: This OPTION only works in combination with **--export, -e**.*
#### **--ignore-volumes**
This OPTION must be used in combination with the **--export, -e** OPTION.
When this OPTION is specified, the content of volumes associated with
-the *container* will not be included into the checkpoint tar.gz file. The default is **false**.
+the *container* will not be included into the checkpoint tar.gz file.\
+The default is **false**.
#### **--keep**, **-k**
-Keep all temporary log and statistics files created by CRIU during checkpointing. These files are not deleted if checkpointing fails for further debugging. If checkpointing succeeds these files are theoretically not needed, but if these files are needed Podman can keep the files for further analysis. The default is **false**.
+Keep all temporary log and statistics files created by CRIU during checkpointing. These files are not deleted if checkpointing fails for further debugging. If checkpointing succeeds these files are theoretically not needed, but if these files are needed Podman can keep the files for further analysis.\
+The default is **false**.
#### **--latest**, **-l**
-Instead of providing the *container ID* or *name*, use the last created *container*. If you use methods other than Podman to run *containers* such as `CRI-O`, the last started *container* could be from either of those methods. The default is **false**.\
-*IMPORTANT: This OPTION is not available with the remote Podman client.*
+Instead of providing the *container ID* or *name*, use the last created *container*. If other methods than Podman are used to run *containers* such as `CRI-O`, the last started *container* could be from either of those methods.\
+The default is **false**.\
+*IMPORTANT: This OPTION is not available with the remote Podman client. This OPTION does not need a container name or ID as input argument.*
#### **--leave-running**, **-R**
-Leave the *container* running after checkpointing instead of stopping it. The default is **false**.
+Leave the *container* running after checkpointing instead of stopping it.\
+The default is **false**.
#### **--pre-checkpoint**, **-P**
Dump the *container's* memory information only, leaving the *container* running. Later
-operations will supersede prior dumps. It only works on `runc 1.0-rc3` or `higher`. The default is **false**.
+operations will supersede prior dumps. It only works on `runc 1.0-rc3` or `higher`.\
+The default is **false**.
#### **--tcp-established**
Checkpoint a *container* with established TCP connections. If the checkpoint
image contains established TCP connections, this OPTION is required during
restore. Defaults to not checkpointing *containers* with established TCP
-connections. The default is **false**.
+connections.\
+The default is **false**.
#### **--with-previous**
-Check out the *container* with previous criu image files in pre-dump. It only works on `runc 1.0-rc3` or `higher`. The default is **false**.\
+Check out the *container* with previous criu image files in pre-dump. It only works on `runc 1.0-rc3` or `higher`.\
+The default is **false**.\
*IMPORTANT: This OPTION is not available with **--pre-checkpoint***.
## EXAMPLES
-
Make a checkpoint for the container "mywebserver".
```
# podman container checkpoint mywebserver
diff --git a/docs/source/markdown/podman-container-cleanup.1.md b/docs/source/markdown/podman-container-cleanup.1.md
index f33b68a1c..29e34f1cf 100644
--- a/docs/source/markdown/podman-container-cleanup.1.md
+++ b/docs/source/markdown/podman-container-cleanup.1.md
@@ -8,13 +8,14 @@ podman\-container\-cleanup - Cleanup the container's network and mountpoints
## DESCRIPTION
**podman container cleanup** cleans up exited *containers* by removing all mountpoints and network configuration from the host. The *container name* or *ID* can be used. The cleanup command does not remove the *containers*. Running *containers* will not be cleaned up.\
-Sometimes container mount points and network stacks can remain if the podman command was killed or the *container* ran in daemon mode. This command is automatically executed when you run *containers* in daemon mode by the `conmon process` when the *container* exits.
+Sometimes container mount points and network stacks can remain if the podman command was killed or the *container* ran in daemon mode. This command is automatically executed when *containers* are run in daemon mode by the `conmon process` when the *container* exits.
## OPTIONS
-
#### **--all**, **-a**
-Cleanup all *containers*. The default is **false**.
+Cleanup all *containers*.\
+The default is **false**.\
+*IMPORTANT: This OPTION does not need a container name or ID as input argument.*
#### **--exec**=*session*
@@ -24,19 +25,21 @@ Can only be specified if a single *container* is being cleaned up (conflicts wit
#### **--latest**, **-l**
-Instead of providing the *container ID* or *name*, use the last created *container*. If you use methods other than Podman to run *containers* such as `CRI-O`, the last started *container* could be from either of those methods. The default is **false**.\
-*IMPORTANT: This OPTION is not available with the remote Podman client.*
+Instead of providing the *container ID* or *name*, use the last created *container*. If other methods than Podman are used to run *containers* such as `CRI-O`, the last started *container* could be from either of those methods.\
+The default is **false**.\
+*IMPORTANT: This OPTION is not available with the remote Podman client. This OPTION does not need a container name or ID as input argument.*
#### **--rm**
-After cleanup, remove the *container* entirely. The default is **false**.
+After cleanup, remove the *container* entirely.\
+The default is **false**.
#### **--rmi**
-After cleanup, remove the image entirely. The default is **false**.
+After cleanup, remove the image entirely.\
+The default is **false**.
## EXAMPLES
-
Cleanup the container "mywebserver".
```
$ podman container cleanup mywebserver
diff --git a/docs/source/markdown/podman-container-exists.1.md b/docs/source/markdown/podman-container-exists.1.md
index e42489d63..d059276d7 100644
--- a/docs/source/markdown/podman-container-exists.1.md
+++ b/docs/source/markdown/podman-container-exists.1.md
@@ -11,12 +11,15 @@ podman\-container\-exists - Check if a container exists in local storage
of `0` when the container is found. A `1` will be returned otherwise. An exit code of `125` indicates there was an issue accessing the local storage.
## OPTIONS
-
#### **--external**
-Check for external *containers* as well as Podman *containers*. These external *containers* are generally created via other container technology such as `Buildah` or `CRI-O`. The default is **false**.
+
+Check for external *containers* as well as Podman *containers*. These external *containers* are generally created via other container technology such as `Buildah` or `CRI-O`.\
+The default is **false**.
**-h**, **--help**
-Prints usage statement.
+
+Prints usage statement.\
+The default is **false**.
## EXAMPLES
diff --git a/docs/source/markdown/podman-container-prune.1.md b/docs/source/markdown/podman-container-prune.1.md
index b199f9ebb..06014897f 100644
--- a/docs/source/markdown/podman-container-prune.1.md
+++ b/docs/source/markdown/podman-container-prune.1.md
@@ -1,7 +1,7 @@
% podman-container-prune(1)
## NAME
-podman-container-prune - Remove all stopped containers from local storage
+podman\-container\-prune - Remove all stopped containers from local storage
## SYNOPSIS
**podman container prune** [*options*]
@@ -10,35 +10,37 @@ podman-container-prune - Remove all stopped containers from local storage
**podman container prune** removes all stopped containers from local storage.
## OPTIONS
-
#### **--filter**=*filters*
Provide filter values.
-The --filter flag format is of “key=value”. If there is more than one filter, then pass multiple flags (e.g., --filter "foo=bar" --filter "bif=baz")
+The *filters* argument format is of `key=value`. If there is more than one *filter*, then pass multiple OPTIONS: **--filter** *foo=bar* **--filter** *bif=baz*.
Supported filters:
-- `until` (_timestamp_) - only remove containers and images created before given timestamp
-- `label` (label=_key_, label=_key=value_, label!=_key_, or label!=_key=value_) - only remove containers and images, with (or without, in case label!=... is used) the specified labels.
+| Filter | Description |
+| :----------------: | --------------------------------------------------------------------------- |
+| *until* | Only remove containers and images created before given timestamp. |
+| *label* | Only remove containers and images, with (or without, in case label!=[...] is used) the specified labels. |
-The until filter can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. 10m, 1h30m) computed relative to the machine’s time.
+The `until` *filter* can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. 10m, 1h30m) computed relative to the machine’s time.
-The label filter accepts two formats. One is the label=... (label=_key_ or label=_key=value_), which removes containers with the specified labels. The other format is the label!=... (label!=_key_ or label!=_key=value_), which removes containers without the specified labels.
+The `label` *filter* accepts two formats. One is the `label`=*key*, `label`=*key*=*value*, which removes containers with the specified labels. The other format is the `label!`=*key*, or `label!`=*key*=*value*, which removes containers without the specified labels.
#### **--force**, **-f**
-Do not provide an interactive prompt for container removal.
+Do not provide an interactive prompt for container removal.\
+The default is **false**.
**-h**, **--help**
-Print usage statement
+Print usage statement.\
+The default is **false**.
## EXAMPLES
-
Remove all stopped containers from local storage
```
-$ sudo podman container prune
+$ podman container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
878392adf2e6c5c9bb1fc19b69d37d2e98c8abf9d539c0bce4b15b46bbcce471
@@ -51,7 +53,7 @@ fff1c5b6c3631746055ec40598ce8ecaa4b82aef122f9e3a85b03b55c0d06c23
Remove all stopped containers from local storage without confirmation.
```
-$ sudo podman container prune -f
+$ podman container prune -f
878392adf2e6c5c9bb1fc19b69d37d2e98c8abf9d539c0bce4b15b46bbcce471
37664467fbe3618bf9479c34393ac29c02696675addf1750f9e346581636cde7
ed0c6468b8e1cb641b4621d1fe30cb477e1fefc5c0bceb66feaf2f7cb50e5962
@@ -63,15 +65,15 @@ fff1c5b6c3631746055ec40598ce8ecaa4b82aef122f9e3a85b03b55c0d06c23
Remove all stopped containers from local storage created within last 10 minutes
```
-$ sudo podman container prune --filter until="10m"
+$ podman container prune --filter until="10m"
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
3d366295e33d8cc612c4d873199bacadd55088d90d17dcafaa9a2d317ad50b4e
```
## SEE ALSO
-podman(1), podman-ps
+**[podman(1)](podman.1.md)**, **[podman-ps](podman-ps.1.md)**
## HISTORY
-December 2018, Originally compiled by Brent Baude (bbaude at redhat dot com)
-December 2020, converted filter information from docs.docker.com documentation by Dan Walsh (dwalsh at redhat dot com)
+December 2018, Originally compiled by Brent Baude <bbaude@redhat.com>\
+December 2020, converted filter information from docs.docker.com documentation by Dan Walsh <dwalsh@redhat.com>
diff --git a/docs/source/markdown/podman-container-restore.1.md b/docs/source/markdown/podman-container-restore.1.md
index 82bf76d1e..21021b952 100644
--- a/docs/source/markdown/podman-container-restore.1.md
+++ b/docs/source/markdown/podman-container-restore.1.md
@@ -4,120 +4,131 @@
podman\-container\-restore - Restores one or more containers from a checkpoint
## SYNOPSIS
-**podman container restore** [*options*] *container* ...
+**podman container restore** [*options*] *container* [*container* ...]
## DESCRIPTION
-Restores a container from a checkpoint. You may use container IDs or names as input.
+**podman container restore** restores a container from a checkpoint. The *container IDs* or *names* are used as input.
## OPTIONS
+#### **--all**, **-a**
+
+Restore all checkpointed *containers*.\
+The default is **false**.\
+*IMPORTANT: This OPTION does not need a container name or ID as input argument.*
+
#### **--keep**, **-k**
-Keep all temporary log and statistics files created by CRIU during
+Keep all temporary log and statistics files created by `CRIU` during
checkpointing as well as restoring. These files are not deleted if restoring
fails for further debugging. If restoring succeeds these files are
theoretically not needed, but if these files are needed Podman can keep the
files for further analysis. This includes the checkpoint directory with all
files created during checkpointing. The size required by the checkpoint
directory is roughly the same as the amount of memory required by the
-processes in the checkpointed container.
-
-Without the **-k**, **--keep** option the checkpoint will be consumed and cannot be used
-again.
-
-#### **--all**, **-a**
-
-Restore all checkpointed containers.
+processes in the checkpointed *container*.\
+Without the **--keep**, **-k** option the checkpoint will be consumed and cannot be used again.\
+The default is **false**.
#### **--latest**, **-l**
-Instead of providing the container name or ID, restore the last created container. (This option is not available with the remote Podman client)
-
-#### **--tcp-established**
-
-Restore a container with established TCP connections. If the checkpoint image
-contains established TCP connections, this option is required during restore.
-If the checkpoint image does not contain established TCP connections this
-option is ignored. Defaults to not restoring containers with established TCP
-connections.
-
-#### **--import**, **-i**
-
-Import a checkpoint tar.gz file, which was exported by Podman. This can be used
-to import a checkpointed container from another host. Do not specify a *container*
-argument when using this option.
-
-#### **--import-previous**
-
-Import a pre-checkpoint tar.gz file which was exported by Podman. This option
-must be used with **-i** or **--import**. It only works on runc 1.0-rc3 or higher.
-
-#### **--name**, **-n**
-
-This is only available in combination with **--import, -i**. If a container is restored
-from a checkpoint tar.gz file it is possible to rename it with **--name, -n**. This
-way it is possible to restore a container from a checkpoint multiple times with different
-names.
-
-If the **--name, -n** option is used, Podman will not attempt to assign the same IP
-address to the container it was using before checkpointing as each IP address can only
-be used once and the restored container will have another IP address. This also means
-that **--name, -n** cannot be used in combination with **--tcp-established**.
+Instead of providing the *container ID* or *name*, use the last created *container*. If other methods than Podman are used to run *containers* such as `CRI-O`, the last started *container* could be from either of those methods.\
+The default is **false**.\
+*IMPORTANT: This OPTION is not available with the remote Podman client. This OPTION does not need a container name or ID as input argument.*
#### **--ignore-rootfs**
-This is only available in combination with **--import, -i**. If a container is restored
-from a checkpoint tar.gz file it is possible that it also contains all root file-system
-changes. With **--ignore-rootfs** it is possible to explicitly disable applying these
-root file-system changes to the restored container.
+If a *container* is restored from a checkpoint tar.gz file it is possible that it also contains all root file-system changes. With **--ignore-rootfs** it is possible to explicitly disable applying these root file-system changes to the restored *container*.\
+The default is **false**.\
+*IMPORTANT: This OPTION is only available in combination with **--import, -i**.*
#### **--ignore-static-ip**
-If the container was started with **--ip** the restored container also tries to use that
+If the *container* was started with **--ip** the restored *container* also tries to use that
IP address and restore fails if that IP address is already in use. This can happen, if
-a container is restored multiple times from an exported checkpoint with **--name, -n**.
+a *container* is restored multiple times from an exported checkpoint with **--name, -n**.
Using **--ignore-static-ip** tells Podman to ignore the IP address if it was configured
-with **--ip** during container creation.
+with **--ip** during *container* creation.
+
+The default is **false**.
#### **--ignore-static-mac**
-If the container was started with **--mac-address** the restored container also
+If the *container* was started with **--mac-address** the restored *container* also
tries to use that MAC address and restore fails if that MAC address is already
-in use. This can happen, if a container is restored multiple times from an
+in use. This can happen, if a *container* is restored multiple times from an
exported checkpoint with **--name, -n**.
Using **--ignore-static-mac** tells Podman to ignore the MAC address if it was
-configured with **--mac-address** during container creation.
+configured with **--mac-address** during *container* creation.
+
+The default is **false**.
#### **--ignore-volumes**
This option must be used in combination with the **--import, -i** option.
-When restoring containers from a checkpoint tar.gz file with this option,
-the content of associated volumes will not be restored.
+When restoring *containers* from a checkpoint tar.gz file with this option,
+the content of associated volumes will not be restored.\
+The default is **false**.
-#### **--publish**, **-p**
+#### **--import**, **-i**=*file*
-Replaces the ports that the container publishes, as configured during the
-initial container start, with a new set of port forwarding rules.
+Import a checkpoint tar.gz file, which was exported by Podman. This can be used
+to import a checkpointed *container* from another host.\
+*IMPORTANT: This OPTION does not need a container name or ID as input argument.*
-```
-# podman run --rm -p 2345:80 -d webserver
-# podman container checkpoint -l --export=dump.tar
-# podman container restore -p 5432:8080 --import=dump.tar
-```
+#### **--import-previous**=*file*
-For more details please see **podman run --publish**.
+Import a pre-checkpoint tar.gz file which was exported by Podman. This option
+must be used with **-i** or **--import**. It only works on `runc 1.0-rc3` or `higher`.
-## EXAMPLE
+#### **--name**, **-n**=*name*
+
+If a *container* is restored from a checkpoint tar.gz file it is possible to rename it with **--name, -n**. This way it is possible to restore a *container* from a checkpoint multiple times with different
+names.
+
+If the **--name, -n** option is used, Podman will not attempt to assign the same IP
+address to the *container* it was using before checkpointing as each IP address can only
+be used once and the restored *container* will have another IP address. This also means
+that **--name, -n** cannot be used in combination with **--tcp-established**.\
+*IMPORTANT: This OPTION is only available in combination with **--import, -i**.*
+
+#### **--publish**, **-p**=*port*
+
+Replaces the ports that the *container* publishes, as configured during the
+initial *container* start, with a new set of port forwarding rules.
+
+For more details please see **[podman run --publish](podman-run.1.md#--publish)**.
+
+#### **--tcp-established**
-podman container restore mywebserver
+Restore a *container* with established TCP connections. If the checkpoint image
+contains established TCP connections, this option is required during restore.
+If the checkpoint image does not contain established TCP connections this
+option is ignored. Defaults to not restoring *containers* with established TCP
+connections.\
+The default is **false**.
-podman container restore 860a4b23
+## EXAMPLE
+Restores the container "mywebserver".
+```
+# podman container restore mywebserver
+```
-podman container restore --import-previous pre-checkpoint.tar.gz --import checkpoint.tar.gz
+Import a checkpoint file and a pre-checkpoint file.
+```
+# podman container restore --import-previous pre-checkpoint.tar.gz --import checkpoint.tar.gz
+```
+
+Remove the container "mywebserver". Make a checkpoint of the container and export it. Restore the container with other port ranges from the exported file.
+```
+$ podman run --rm -p 2345:80 -d webserver
+# podman container checkpoint -l --export=dump.tar
+# podman container restore -p 5432:8080 --import=dump.tar
+```
## SEE ALSO
-podman(1), podman-container-checkpoint(1), podman-run(1)
+**[podman(1)](podman.1.md)**, **[podman-container-checkpoint(1)](podman-container-checkpoint.1.md)**, **[podman-run(1)](podman-run.1.md)**
## HISTORY
September 2018, Originally compiled by Adrian Reber <areber@redhat.com>
diff --git a/docs/source/markdown/podman-image-unmount.1.md b/docs/source/markdown/podman-image-unmount.1.md
index 62e879fa1..2fedb8f58 100644
--- a/docs/source/markdown/podman-image-unmount.1.md
+++ b/docs/source/markdown/podman-image-unmount.1.md
@@ -12,7 +12,7 @@ podman\-image\-unmount - Unmount an image's root filesystem
Unmounts the specified images' root file system, if no other processes
are using it.
-Image storage increments a mount counter each time a image is mounted.
+Image storage increments a mount counter each time an image is mounted.
When a image is unmounted, the mount counter is decremented, and the
image's root filesystem is physically unmounted only when the mount
counter reaches zero indicating no other processes are using the mount.
diff --git a/docs/source/markdown/podman-image.1.md b/docs/source/markdown/podman-image.1.md
index bbf5f6d84..1b0dc395d 100644
--- a/docs/source/markdown/podman-image.1.md
+++ b/docs/source/markdown/podman-image.1.md
@@ -18,7 +18,7 @@ The image command allows you to manage images
| exists | [podman-image-exists(1)](podman-image-exists.1.md) | Check if an image exists in local storage. |
| history | [podman-history(1)](podman-history.1.md) | Show the history of an image. |
| import | [podman-import(1)](podman-import.1.md) | Import a tarball and save it as a filesystem image. |
-| inspect | [podman-inspect(1)](podman-inspect.1.md) | Display a image or image's configuration. |
+| inspect | [podman-inspect(1)](podman-inspect.1.md) | Display an image or image's configuration. |
| list | [podman-images(1)](podman-images.1.md) | List the container images on the system.(alias ls) |
| load | [podman-load(1)](podman-load.1.md) | Load an image from the docker archive. |
| mount | [podman-image-mount(1)](podman-image-mount.1.md) | Mount an image's root filesystem. |
diff --git a/docs/source/markdown/podman-pull.1.md b/docs/source/markdown/podman-pull.1.md
index 54f990601..084327efd 100644
--- a/docs/source/markdown/podman-pull.1.md
+++ b/docs/source/markdown/podman-pull.1.md
@@ -21,42 +21,30 @@ Images are stored in local image storage.
## SOURCE
- The SOURCE is the location from which the container images are pulled.
- The Image "SOURCE" uses a "transport":"details" format. Only the `docker` (container registry)
- transport is allowed for remote access.
+ SOURCE is the location from the container image is pulled from. It supports all transports from `containers-transports(5)`. If no transport is specified, the input is subject to short-name resolution and the `docker` (i.e., container registry) transport is used. For remote clients, `docker` is the only supported transport.
- Multiple transports are supported:
-
- **dir:**_path_
- An existing local directory _path_ storing the manifest, layer tarballs and signatures as individual files. This
- is a non-standardized format, primarily useful for debugging or noninvasive container inspection.
-
- $ podman pull dir:/tmp/myimage
-
- **docker://**_docker-reference_ (Default)
- An image reference stored in a remote container image registry. The reference can include a path to a
- specific registry; if it does not, the registries listed in registries.conf will be queried to find a matching
- image. By default, credentials from podman login (stored at $XDG_RUNTIME_DIR/containers/auth.json by default)
- will be used to authenticate; if these cannot be found, we will fall back to using credentials in
- $HOME/.docker/config.json.
-
- $ podman pull quay.io/username/myimage
+```
+# Pull from a container registry
+$ podman pull quay.io/username/myimage
- **docker-archive:**_path_[**:**_docker-reference_]
- An image is stored in the `docker save` formatted file. _docker-reference_ is only used when creating such a
- file, and it must not contain a digest.
+# Pull from a container registry with short-name resolution
+$ podman pull fedora
- $ podman pull docker-archive:/tmp/myimage
+# Pull from a container registry via the docker transport
+$ podman pull docker://quay.io/username/myimage
- **docker-daemon:**_docker-reference_
- An image in _docker-reference_ format stored in the docker daemon internal storage. The _docker-reference_ can also be an image ID (docker-daemon:algo:digest).
+# Pull from a local directory
+$ podman pull dir:/tmp/myimage
- $ sudo podman pull docker-daemon:docker.io/library/myimage:33
+# Pull from a tarball in the docker-archive format
+$ podman pull docker-archive:/tmp/myimage
- **oci-archive:**_path_**:**_tag_
- An image _tag_ in a directory compliant with "Open Container Image Layout Specification" at _path_.
+# Pull from a local docker daemon
+$ sudo podman pull docker-daemon:docker.io/library/myimage:33
- $ podman pull oci-archive:/tmp/myimage
+# Pull from a tarball in the OCI-archive format
+$ podman pull oci-archive:/tmp/myimage
+```
## OPTIONS
@@ -217,7 +205,7 @@ registries.conf is the configuration file which specifies which container regist
NOTE: Use the environment variable `TMPDIR` to change the temporary storage location of downloaded container images. Podman defaults to use `/var/tmp`.
## SEE ALSO
-podman(1), podman-push(1), podman-login(1), containers-certs.d(5), containers-registries.conf(5)
+podman(1), podman-push(1), podman-login(1), containers-certs.d(5), containers-registries.conf(5), containers-transports(5)
## HISTORY
July 2017, Originally compiled by Urvashi Mohnani <umohnani@redhat.com>
diff --git a/docs/source/markdown/podman-push.1.md b/docs/source/markdown/podman-push.1.md
index e26d73891..68478accd 100644
--- a/docs/source/markdown/podman-push.1.md
+++ b/docs/source/markdown/podman-push.1.md
@@ -20,37 +20,30 @@ Images are pushed from those stored in local image storage.
## DESTINATION
- The DESTINATION is a location to store container images
- The Image "DESTINATION" uses a "transport":"details" format.
- If a transport is not given, podman push will attempt to push
- to a registry.
+ DESTINATION is the location the container image is pushed to. It supports all transports from `containers-transports(5)`. If no transport is specified, the `docker` (i.e., container registry) transport is used. For remote clients, `docker` is the only supported transport.
- Multiple transports are supported:
-
- **dir:**_path_
- An existing local directory _path_ storing the manifest, layer tarballs and signatures as individual files. This is a non-standardized format, primarily useful for debugging or noninvasive container inspection.
-
- $ podman push myimage dir:/tmp/myimage
-
- **docker://**_docker-reference_
- An image in a registry implementing the "Docker Registry HTTP API V2". By default, uses the authorization state in `$XDG_RUNTIME_DIR/containers/auth.json`, which is set using `(podman login)`. If the authorization state is not found there, `$HOME/.docker/config.json` is checked, which is set using `(docker login)`.
-
- $ podman push myimage quay.io/username/myimage
+```
+# Push to a container registry
+$ podman push quay.io/podman/stable
- **docker-archive:**_path_[**:**_docker-reference_]
- An image is stored in the `docker save` formatted file. _docker-reference_ is only used when creating such a file, and it must not contain a digest.
+# Push to a container registry via the docker transport
+$ podman push docker://quay.io/podman/stable
- $ podman push myimage docker-archive:/tmp/myimage
+# Push to a container registry with another tag
+$ podman push myimage quay.io/username/myimage
- **docker-daemon:**_docker-reference_
- An image in _docker-reference_ format stored in the docker daemon internal storage. _docker-reference_ must contain a tag.
+# Push to a local directory
+$ podman push myimage dir:/tmp/myimage
- $ sudo podman push myimage docker-daemon:docker.io/library/myimage:33
+# Push to a tarball in the docker-archive format
+$ podman push myimage docker-archive:/tmp/myimage
- **oci-archive:**_path_**:**_tag_
- An image _tag_ in a directory compliant with "Open Container Image Layout Specification" at _path_.
+# Push to a local docker daemon
+$ sudo podman push myimage docker-daemon:docker.io/library/myimage:33
- $ podman push myimage oci-archive:/tmp/myimage
+# Push to a tarball in the OCI format
+$ podman push myimage oci-archive:/tmp/myimage
+```
## OPTIONS
@@ -161,4 +154,4 @@ Storing signatures
```
## SEE ALSO
-podman(1), podman-pull(1), podman-login(1), containers-certs.d(5)
+podman(1), podman-pull(1), podman-login(1), containers-certs.d(5), containers-transports(5)
diff --git a/go.mod b/go.mod
index 46a72c567..e8ebb88fe 100644
--- a/go.mod
+++ b/go.mod
@@ -12,7 +12,7 @@ require (
github.com/containernetworking/cni v0.8.1
github.com/containernetworking/plugins v0.9.1
github.com/containers/buildah v1.21.1
- github.com/containers/common v0.40.1-0.20210617134614-c6578d76fb0d
+ github.com/containers/common v0.40.2-0.20210623133759-d13a31743aec
github.com/containers/conmon v2.0.20+incompatible
github.com/containers/image/v5 v5.13.2
github.com/containers/ocicrypt v1.1.1
diff --git a/go.sum b/go.sum
index 33dab408c..e2a83a95f 100644
--- a/go.sum
+++ b/go.sum
@@ -221,12 +221,11 @@ github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRD
github.com/containers/buildah v1.21.1 h1:e9LmTCUKUBLg72v5DnIOT/wc8ffkfB7LbpQBywLZo20=
github.com/containers/buildah v1.21.1/go.mod h1:yPdlpVd93T+i91yGxrJbW1YOWrqN64j5ZhHOZmHUejs=
github.com/containers/common v0.38.4/go.mod h1:egfpX/Y3+19Dz4Wa1eRZDdgzoEOeneieF9CQppKzLBg=
-github.com/containers/common v0.40.1-0.20210617134614-c6578d76fb0d h1:PaS/t2XcyxEDOr685T+3HPMyMqN99UPcj6I92nqIDH8=
-github.com/containers/common v0.40.1-0.20210617134614-c6578d76fb0d/go.mod h1:+zxauZzkurY5tbQGDxrCV6rF694RX1olXyYRVJHrzWo=
+github.com/containers/common v0.40.2-0.20210623133759-d13a31743aec h1:ZcteA2klZSZAZgVonwJAqezF6hdO9SMKUy49ZHXZd38=
+github.com/containers/common v0.40.2-0.20210623133759-d13a31743aec/go.mod h1:J23CfuhN1fAg85q5HxS6SKYhKbGqmqieKQqoHaQbEI8=
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
github.com/containers/image/v5 v5.12.0/go.mod h1:VasTuHmOw+uD0oHCfApQcMO2+36SfyncoSahU7513Xs=
-github.com/containers/image/v5 v5.13.2-0.20210617132750-db0df5e0cf5e/go.mod h1:GkWursKDlDcUIT7L7vZf70tADvZCk/Ga0wgS0MuF0ag=
github.com/containers/image/v5 v5.13.2 h1:AgYunV/9d2fRkrmo23wH2MkqeHolFd6oQCkK+1PpuFA=
github.com/containers/image/v5 v5.13.2/go.mod h1:GkWursKDlDcUIT7L7vZf70tADvZCk/Ga0wgS0MuF0ag=
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b h1:Q8ePgVfHDplZ7U33NwHZkrVELsZP5fYj9pM5WBZB2GE=
diff --git a/libpod/define/containerstate.go b/libpod/define/containerstate.go
index 5d2bc9099..fc272beaa 100644
--- a/libpod/define/containerstate.go
+++ b/libpod/define/containerstate.go
@@ -1,6 +1,10 @@
package define
-import "github.com/pkg/errors"
+import (
+ "time"
+
+ "github.com/pkg/errors"
+)
// ContainerStatus represents the current state of a container
type ContainerStatus int
@@ -120,12 +124,14 @@ func (s ContainerExecStatus) String() string {
// ContainerStats contains the statistics information for a running container
type ContainerStats struct {
+ AvgCPU float64
ContainerID string
Name string
PerCPU []uint64
CPU float64
CPUNano uint64
CPUSystemNano uint64
+ DataPoints int64
SystemNano uint64
MemUsage uint64
MemLimit uint64
@@ -135,4 +141,6 @@ type ContainerStats struct {
BlockInput uint64
BlockOutput uint64
PIDs uint64
+ UpTime time.Duration
+ Duration uint64
}
diff --git a/libpod/stats.go b/libpod/stats.go
index f4732b4fc..6f0360ef1 100644
--- a/libpod/stats.go
+++ b/libpod/stats.go
@@ -56,7 +56,11 @@ func (c *Container) GetContainerStats(previousStats *define.ContainerStats) (*de
previousCPU := previousStats.CPUNano
now := uint64(time.Now().UnixNano())
+ stats.Duration = cgroupStats.CPU.Usage.Total
+ stats.UpTime = time.Duration(stats.Duration)
stats.CPU = calculateCPUPercent(cgroupStats, previousCPU, now, previousStats.SystemNano)
+ stats.AvgCPU = calculateAvgCPU(stats.CPU, previousStats.AvgCPU, previousStats.DataPoints)
+ stats.DataPoints = previousStats.DataPoints + 1
stats.MemUsage = cgroupStats.Memory.Usage.Usage
stats.MemLimit = getMemLimit(cgroupStats.Memory.Usage.Limit)
stats.MemPerc = (float64(stats.MemUsage) / float64(stats.MemLimit)) * 100
@@ -127,3 +131,9 @@ func calculateBlockIO(stats *cgroups.Metrics) (read uint64, write uint64) {
}
return
}
+
+// calculateAvgCPU calculates the avg CPU percentage given the previous average and the number of data points.
+func calculateAvgCPU(statsCPU float64, prevAvg float64, prevData int64) float64 {
+ avgPer := ((prevAvg * float64(prevData)) + statsCPU) / (float64(prevData) + 1)
+ return avgPer
+}
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index 6bc02dd2b..2a0a0b725 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -403,6 +403,24 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
state.Status = define.ContainerStateCreated.String()
}
+ state.Health = &types.Health{
+ Status: inspect.State.Healthcheck.Status,
+ FailingStreak: inspect.State.Healthcheck.FailingStreak,
+ }
+
+ log := inspect.State.Healthcheck.Log
+
+ for _, item := range log {
+ res := &types.HealthcheckResult{}
+ s, _ := time.Parse(time.RFC3339Nano, item.Start)
+ e, _ := time.Parse(time.RFC3339Nano, item.End)
+ res.Start = s
+ res.End = e
+ res.ExitCode = item.ExitCode
+ res.Output = item.Output
+ state.Health.Log = append(state.Health.Log, res)
+ }
+
formatCapabilities(inspect.HostConfig.CapDrop)
formatCapabilities(inspect.HostConfig.CapAdd)
diff --git a/pkg/api/handlers/libpod/images_pull.go b/pkg/api/handlers/libpod/images_pull.go
index e88b53a4b..04b415638 100644
--- a/pkg/api/handlers/libpod/images_pull.go
+++ b/pkg/api/handlers/libpod/images_pull.go
@@ -26,14 +26,16 @@ func ImagesPull(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
decoder := r.Context().Value("decoder").(*schema.Decoder)
query := struct {
- Reference string `schema:"reference"`
- OS string `schema:"OS"`
- Arch string `schema:"Arch"`
- Variant string `schema:"Variant"`
- TLSVerify bool `schema:"tlsVerify"`
- AllTags bool `schema:"allTags"`
+ Reference string `schema:"reference"`
+ OS string `schema:"OS"`
+ Arch string `schema:"Arch"`
+ Variant string `schema:"Variant"`
+ TLSVerify bool `schema:"tlsVerify"`
+ AllTags bool `schema:"allTags"`
+ PullPolicy string `schema:"policy"`
}{
- TLSVerify: true,
+ TLSVerify: true,
+ PullPolicy: "always",
}
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
@@ -83,12 +85,18 @@ func ImagesPull(w http.ResponseWriter, r *http.Request) {
pullOptions.Writer = writer
+ pullPolicy, err := config.ParsePullPolicy(query.PullPolicy)
+ if err != nil {
+ utils.Error(w, "failed to parse pull policy", http.StatusBadRequest, err)
+ return
+ }
+
var pulledImages []*libimage.Image
var pullError error
runCtx, cancel := context.WithCancel(r.Context())
go func() {
defer cancel()
- pulledImages, pullError = runtime.LibimageRuntime().Pull(runCtx, query.Reference, config.PullPolicyAlways, pullOptions)
+ pulledImages, pullError = runtime.LibimageRuntime().Pull(runCtx, query.Reference, pullPolicy, pullOptions)
}()
flush := func() {
diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go
index d075cd098..3410c53cd 100644
--- a/pkg/api/server/register_images.go
+++ b/pkg/api/server/register_images.go
@@ -974,6 +974,10 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Pull image for the specified variant.
// type: string
// - in: query
+ // name: policy
+ // description: Pull policy, "always" (default), "missing", "newer", "never".
+ // type: string
+ // - in: query
// name: tlsVerify
// description: Require TLS verification.
// type: boolean
diff --git a/pkg/bindings/images/pull.go b/pkg/bindings/images/pull.go
index 9780c3bff..7dfe9560c 100644
--- a/pkg/bindings/images/pull.go
+++ b/pkg/bindings/images/pull.go
@@ -13,7 +13,7 @@ import (
"github.com/containers/podman/v3/pkg/auth"
"github.com/containers/podman/v3/pkg/bindings"
"github.com/containers/podman/v3/pkg/domain/entities"
- "github.com/hashicorp/go-multierror"
+ "github.com/containers/podman/v3/pkg/errorhandling"
"github.com/pkg/errors"
)
@@ -65,7 +65,7 @@ func Pull(ctx context.Context, rawImage string, options *PullOptions) ([]string,
dec := json.NewDecoder(response.Body)
var images []string
- var mErr error
+ var pullErrors []error
for {
var report entities.ImagePullReport
if err := dec.Decode(&report); err != nil {
@@ -77,7 +77,7 @@ func Pull(ctx context.Context, rawImage string, options *PullOptions) ([]string,
select {
case <-response.Request.Context().Done():
- return images, mErr
+ break
default:
// non-blocking select
}
@@ -86,7 +86,7 @@ func Pull(ctx context.Context, rawImage string, options *PullOptions) ([]string,
case report.Stream != "":
fmt.Fprint(stderr, report.Stream)
case report.Error != "":
- mErr = multierror.Append(mErr, errors.New(report.Error))
+ pullErrors = append(pullErrors, errors.New(report.Error))
case len(report.Images) > 0:
images = report.Images
case report.ID != "":
@@ -94,5 +94,5 @@ func Pull(ctx context.Context, rawImage string, options *PullOptions) ([]string,
return images, errors.Errorf("failed to parse pull results stream, unexpected input: %v", report)
}
}
- return images, mErr
+ return images, errorhandling.JoinErrors(pullErrors)
}
diff --git a/pkg/bindings/images/types.go b/pkg/bindings/images/types.go
index 1f3e46729..0aa75a81e 100644
--- a/pkg/bindings/images/types.go
+++ b/pkg/bindings/images/types.go
@@ -147,6 +147,9 @@ type PullOptions struct {
// OS will overwrite the local operating system (OS) for image
// pulls.
OS *string
+ // Policy is the pull policy. Supported values are "missing", "never",
+ // "newer", "always". An empty string defaults to "always".
+ Policy *string
// Password for authenticating against the registry.
Password *string
// Quiet can be specified to suppress pull progress when pulling. Ignored
diff --git a/pkg/bindings/images/types_pull_options.go b/pkg/bindings/images/types_pull_options.go
index 0611c4447..8fcf499eb 100644
--- a/pkg/bindings/images/types_pull_options.go
+++ b/pkg/bindings/images/types_pull_options.go
@@ -84,6 +84,22 @@ func (o *PullOptions) GetOS() string {
return *o.OS
}
+// WithPolicy
+func (o *PullOptions) WithPolicy(value string) *PullOptions {
+ v := &value
+ o.Policy = v
+ return o
+}
+
+// GetPolicy
+func (o *PullOptions) GetPolicy() string {
+ var policy string
+ if o.Policy == nil {
+ return policy
+ }
+ return *o.Policy
+}
+
// WithPassword
func (o *PullOptions) WithPassword(value string) *PullOptions {
v := &value
diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go
index 3fd9a755d..42027a2dc 100644
--- a/pkg/domain/infra/tunnel/images.go
+++ b/pkg/domain/infra/tunnel/images.go
@@ -107,7 +107,7 @@ func (ir *ImageEngine) Pull(ctx context.Context, rawImage string, opts entities.
options := new(images.PullOptions)
options.WithAllTags(opts.AllTags).WithAuthfile(opts.Authfile).WithArch(opts.Arch).WithOS(opts.OS)
options.WithVariant(opts.Variant).WithPassword(opts.Password)
- options.WithQuiet(opts.Quiet).WithUsername(opts.Username)
+ options.WithQuiet(opts.Quiet).WithUsername(opts.Username).WithPolicy(opts.PullPolicy.String())
if s := opts.SkipTLSVerify; s != types.OptionalBoolUndefined {
if s == types.OptionalBoolTrue {
options.WithSkipTLSVerify(true)
diff --git a/pkg/errorhandling/errorhandling.go b/pkg/errorhandling/errorhandling.go
index 9b1740006..6adbc9f34 100644
--- a/pkg/errorhandling/errorhandling.go
+++ b/pkg/errorhandling/errorhandling.go
@@ -15,6 +15,12 @@ func JoinErrors(errs []error) error {
return nil
}
+ // If there's just one error, return it. This prevents the "%d errors
+ // occurred:" header plus list from the multierror package.
+ if len(errs) == 1 {
+ return errs[0]
+ }
+
// `multierror` appends new lines which we need to remove to prevent
// blank lines when printing the error.
var multiE *multierror.Error
@@ -24,9 +30,6 @@ func JoinErrors(errs []error) error {
if finalErr == nil {
return finalErr
}
- if len(multiE.WrappedErrors()) == 1 && logrus.IsLevelEnabled(logrus.TraceLevel) {
- return multiE.WrappedErrors()[0]
- }
return errors.New(strings.TrimSpace(finalErr.Error()))
}
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go
index d00e51e82..e7276892d 100644
--- a/pkg/specgen/generate/container.go
+++ b/pkg/specgen/generate/container.go
@@ -24,7 +24,8 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat
var inspectData *libimage.ImageData
var err error
if s.Image != "" {
- newImage, _, err = r.LibimageRuntime().LookupImage(s.Image, nil)
+ lookupOptions := &libimage.LookupImageOptions{IgnorePlatform: true}
+ newImage, _, err = r.LibimageRuntime().LookupImage(s.Image, lookupOptions)
if err != nil {
return nil, err
}
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index b569f8390..e2901f0b6 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -92,7 +92,8 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener
options = append(options, libpod.WithRootFS(s.Rootfs))
} else {
var resolvedImageName string
- newImage, resolvedImageName, err = rt.LibimageRuntime().LookupImage(s.Image, nil)
+ lookupOptions := &libimage.LookupImageOptions{IgnorePlatform: true}
+ newImage, resolvedImageName, err = rt.LibimageRuntime().LookupImage(s.Image, lookupOptions)
if err != nil {
return nil, err
}
diff --git a/test/apiv2/python/rest_api/test_v2_0_0_container.py b/test/apiv2/python/rest_api/test_v2_0_0_container.py
index b4b3af2df..2fab4aeb9 100644
--- a/test/apiv2/python/rest_api/test_v2_0_0_container.py
+++ b/test/apiv2/python/rest_api/test_v2_0_0_container.py
@@ -14,6 +14,13 @@ class ContainerTestCase(APITestCase):
obj = r.json()
self.assertEqual(len(obj), 1)
+ def test_list_filters(self):
+ r = requests.get(self.podman_url + "/v1.40/containers/json?filters%3D%7B%22status%22%3A%5B%22running%22%5D%7D")
+ self.assertEqual(r.status_code, 200, r.text)
+ payload = r.json()
+ containerAmnt = len(payload)
+ self.assertGreater(containerAmnt, 0)
+
def test_list_all(self):
r = requests.get(self.uri("/containers/json?all=true"))
self.assertEqual(r.status_code, 200, r.text)
@@ -25,6 +32,22 @@ class ContainerTestCase(APITestCase):
self.assertId(r.content)
_ = parse(r.json()["Created"])
+ r = requests.post(
+ self.podman_url + "/v1.40/containers/create?name=topcontainer",
+ json={"Cmd": ["top"], "Image": "alpine:latest"},
+ )
+ self.assertEqual(r.status_code, 201, r.text)
+ payload = r.json()
+ container_id = payload["Id"]
+ self.assertIsNotNone(container_id)
+
+ r = requests.get(self.podman_url + f"/v1.40/containers/{payload['Id']}/json")
+ self.assertEqual(r.status_code, 200, r.text)
+ self.assertId(r.content)
+ out = r.json()
+ state = out["State"]["Health"]
+ self.assertIsInstance(state, dict)
+
def test_stats(self):
r = requests.get(self.uri(self.resolve_container("/containers/{}/stats?stream=false")))
self.assertIn(r.status_code, (200, 409), r.text)
diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go
index 2218d72b5..7ab3dabc9 100644
--- a/test/e2e/stats_test.go
+++ b/test/e2e/stats_test.go
@@ -83,6 +83,17 @@ var _ = Describe("Podman stats", func() {
Expect(session.ExitCode()).To(Equal(0))
})
+ It("podman stats only output CPU data", func() {
+ session := podmanTest.RunTopContainer("")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"stats", "--all", "--no-stream", "--format", "\"{{.ID}} {{.UpTime}} {{.AVGCPU}}\""})
+ session.WaitWithDefaultTimeout()
+ Expect(session.LineInOutputContains("UpTime")).To(BeTrue())
+ Expect(session.LineInOutputContains("AVGCPU")).To(BeTrue())
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
It("podman stats with json output", func() {
var found bool
session := podmanTest.RunTopContainer("")
diff --git a/test/system/255-auto-update.bats b/test/system/255-auto-update.bats
index 9bfb44791..3713243d5 100644
--- a/test/system/255-auto-update.bats
+++ b/test/system/255-auto-update.bats
@@ -194,7 +194,7 @@ function _confirm_update() {
run_podman 125 auto-update
update_log=$output
is "$update_log" ".*invalid auto-update policy.*" "invalid policy setup"
- is "$update_log" ".*1 error occurred.*" "invalid policy setup"
+ is "$update_log" ".*Error: invalid auto-update policy.*" "invalid policy setup"
local n_updated=$(grep -c 'Trying to pull' <<<"$update_log")
is "$n_updated" "2" "Number of images updated from registry."
diff --git a/vendor/github.com/containers/common/libimage/image.go b/vendor/github.com/containers/common/libimage/image.go
index 3bcdbabec..f1272f507 100644
--- a/vendor/github.com/containers/common/libimage/image.go
+++ b/vendor/github.com/containers/common/libimage/image.go
@@ -61,6 +61,24 @@ func (i *Image) reload() error {
return nil
}
+// isCorrupted returns an error if the image may be corrupted.
+func (i *Image) isCorrupted(name string) error {
+ // If it's a manifest list, we're good for now.
+ if _, err := i.getManifestList(); err == nil {
+ return nil
+ }
+
+ ref, err := i.StorageReference()
+ if err != nil {
+ return err
+ }
+
+ if _, err := ref.NewImage(context.Background(), nil); err != nil {
+ return errors.Errorf("Image %s exists in local storage but may be corrupted: %v", name, err)
+ }
+ return nil
+}
+
// Names returns associated names with the image which may be a mix of tags and
// digests.
func (i *Image) Names() []string {
diff --git a/vendor/github.com/containers/common/libimage/pull.go b/vendor/github.com/containers/common/libimage/pull.go
index 0271f0051..0a5e49fd2 100644
--- a/vendor/github.com/containers/common/libimage/pull.go
+++ b/vendor/github.com/containers/common/libimage/pull.go
@@ -105,6 +105,20 @@ func (r *Runtime) Pull(ctx context.Context, name string, pullPolicy config.PullP
r.writeEvent(&Event{ID: "", Name: name, Time: time.Now(), Type: EventTypeImagePull})
}
+ // Some callers may set the platform via the system context at creation
+ // time of the runtime. We need this information to decide whether we
+ // need to enforce pulling from a registry (see
+ // containers/podman/issues/10682).
+ if options.Architecture == "" {
+ options.Architecture = r.systemContext.ArchitectureChoice
+ }
+ if options.OS == "" {
+ options.OS = r.systemContext.OSChoice
+ }
+ if options.Variant == "" {
+ options.Variant = r.systemContext.VariantChoice
+ }
+
var (
pulledImages []string
pullError error
@@ -333,7 +347,7 @@ func (r *Runtime) copyFromRegistry(ctx context.Context, ref types.ImageReference
// from a registry. On successful pull it returns the used fully-qualified
// name that can later be used to look up the image in the local containers
// storage.
-func (r *Runtime) copySingleImageFromRegistry(ctx context.Context, imageName string, pullPolicy config.PullPolicy, options *PullOptions) ([]string, error) {
+func (r *Runtime) copySingleImageFromRegistry(ctx context.Context, imageName string, pullPolicy config.PullPolicy, options *PullOptions) ([]string, error) { //nolint:gocyclo
// Sanity check.
if err := pullPolicy.Validate(); err != nil {
return nil, err
@@ -349,11 +363,41 @@ func (r *Runtime) copySingleImageFromRegistry(ctx context.Context, imageName str
// resolved name for pulling. Assume we're doing a `pull foo`.
// If there's already a local image "localhost/foo", then we should
// attempt pulling that instead of doing the full short-name dance.
- localImage, resolvedImageName, err = r.LookupImage(imageName, nil)
+ lookupOptions := &LookupImageOptions{
+ // NOTE: we must ignore the platform of a local image when
+ // doing lookups. Some images set an incorrect or even invalid
+ // platform (see containers/podman/issues/10682). Doing the
+ // lookup while ignoring the platform checks prevents
+ // redundantly downloading the same image.
+ IgnorePlatform: true,
+ }
+ localImage, resolvedImageName, err = r.LookupImage(imageName, lookupOptions)
if err != nil && errors.Cause(err) != storage.ErrImageUnknown {
logrus.Errorf("Looking up %s in local storage: %v", imageName, err)
}
+ // If the local image is corrupted, we need to repull it.
+ if localImage != nil {
+ if err := localImage.isCorrupted(imageName); err != nil {
+ logrus.Error(err)
+ localImage = nil
+ }
+ }
+
+ // Unless the pull policy is "always", we must pessimistically assume
+ // that the local image has an invalid architecture (see
+ // containers/podman/issues/10682). Hence, whenever the user requests
+ // a custom platform, set the pull policy to "always" to make sure
+ // we're pulling down the image.
+ //
+ // NOTE that this is will even override --pull={false,never}. This is
+ // very likely a bug but a consistent one in Podman/Buildah and should
+ // be addressed at a later point.
+ if pullPolicy != config.PullPolicyAlways && len(options.Architecture)+len(options.OS)+len(options.Variant) > 0 {
+ logrus.Debugf("Enforcing pull policy to %q to support custom platform (arch: %q, os: %q, variant: %q)", "always", options.Architecture, options.OS, options.Variant)
+ pullPolicy = config.PullPolicyAlways
+ }
+
if pullPolicy == config.PullPolicyNever {
if localImage != nil {
logrus.Debugf("Pull policy %q but no local image has been found for %s", pullPolicy, imageName)
diff --git a/vendor/github.com/containers/common/libimage/runtime.go b/vendor/github.com/containers/common/libimage/runtime.go
index efa182544..3cbd3dcf4 100644
--- a/vendor/github.com/containers/common/libimage/runtime.go
+++ b/vendor/github.com/containers/common/libimage/runtime.go
@@ -144,9 +144,8 @@ func (r *Runtime) Exists(name string) (bool, error) {
if image == nil {
return false, nil
}
- // Inspect the image to make sure if it's corrupted or not.
- if _, err := image.Inspect(context.Background(), false); err != nil {
- logrus.Errorf("Image %s exists in local storage but may be corrupted: %v", name, err)
+ if err := image.isCorrupted(name); err != nil {
+ logrus.Error(err)
return false, nil
}
return true, nil
@@ -159,6 +158,13 @@ type LookupImageOptions struct {
// the platform does not matter, for instance, for image removal.
IgnorePlatform bool
+ // Lookup an image matching the specified architecture.
+ Architecture string
+ // Lookup an image matching the specified OS.
+ OS string
+ // Lookup an image matching the specified variant.
+ Variant string
+
// If set, do not look for items/instances in the manifest list that
// match the current platform but return the manifest list as is.
lookupManifest bool
@@ -210,6 +216,25 @@ func (r *Runtime) LookupImage(name string, options *LookupImageOptions) (*Image,
name = strings.TrimPrefix(name, "sha256:")
}
+ // Set the platform for matching local images.
+ if !options.IgnorePlatform {
+ if options.Architecture == "" {
+ options.Architecture = r.systemContext.ArchitectureChoice
+ }
+ if options.Architecture == "" {
+ options.Architecture = runtime.GOARCH
+ }
+ if options.OS == "" {
+ options.OS = r.systemContext.OSChoice
+ }
+ if options.OS == "" {
+ options.OS = runtime.GOOS
+ }
+ if options.Variant == "" {
+ options.Variant = r.systemContext.VariantChoice
+ }
+ }
+
// First, check if we have an exact match in the storage. Maybe an ID
// or a fully-qualified image name.
img, err := r.lookupImageInLocalStorage(name, name, options)
@@ -295,7 +320,7 @@ func (r *Runtime) lookupImageInLocalStorage(name, candidate string, options *Loo
if err != nil {
return nil, err
}
- instance, err := manifestList.LookupInstance(context.Background(), "", "", "")
+ instance, err := manifestList.LookupInstance(context.Background(), options.Architecture, options.OS, options.Variant)
if err != nil {
// NOTE: If we are not looking for a specific platform
// and already found the manifest list, then return it
@@ -316,7 +341,7 @@ func (r *Runtime) lookupImageInLocalStorage(name, candidate string, options *Loo
return image, nil
}
- matches, err := imageReferenceMatchesContext(context.Background(), ref, &r.systemContext)
+ matches, err := r.imageReferenceMatchesContext(ref, options)
if err != nil {
return nil, err
}
@@ -428,12 +453,13 @@ func (r *Runtime) ResolveName(name string) (string, error) {
}
// imageReferenceMatchesContext return true if the specified reference matches
-// the platform (os, arch, variant) as specified by the system context.
-func imageReferenceMatchesContext(ctx context.Context, ref types.ImageReference, sys *types.SystemContext) (bool, error) {
- if sys == nil {
+// the platform (os, arch, variant) as specified by the lookup options.
+func (r *Runtime) imageReferenceMatchesContext(ref types.ImageReference, options *LookupImageOptions) (bool, error) {
+ if options.IgnorePlatform {
return true, nil
}
- img, err := ref.NewImage(ctx, sys)
+ ctx := context.Background()
+ img, err := ref.NewImage(ctx, &r.systemContext)
if err != nil {
return false, err
}
@@ -442,16 +468,8 @@ func imageReferenceMatchesContext(ctx context.Context, ref types.ImageReference,
if err != nil {
return false, err
}
- osChoice := sys.OSChoice
- if osChoice == "" {
- osChoice = runtime.GOOS
- }
- arch := sys.ArchitectureChoice
- if arch == "" {
- arch = runtime.GOARCH
- }
- if osChoice == data.Os && arch == data.Architecture {
- if sys.VariantChoice == "" || sys.VariantChoice == data.Variant {
+ if options.OS == data.Os && options.Architecture == data.Architecture {
+ if options.Variant == "" || options.Variant == data.Variant {
return true, nil
}
}
diff --git a/vendor/github.com/containers/common/pkg/config/config.go b/vendor/github.com/containers/common/pkg/config/config.go
index 0d23d6ac6..af6efbbf2 100644
--- a/vendor/github.com/containers/common/pkg/config/config.go
+++ b/vendor/github.com/containers/common/pkg/config/config.go
@@ -1053,7 +1053,7 @@ func (c *Config) Write() error {
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
return err
}
- configFile, err := os.OpenFile(path, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0600)
+ configFile, err := os.OpenFile(path, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0644)
if err != nil {
return err
}
diff --git a/vendor/github.com/containers/common/pkg/seccomp/default_linux.go b/vendor/github.com/containers/common/pkg/seccomp/default_linux.go
index edb1294d6..725e0bfc7 100644
--- a/vendor/github.com/containers/common/pkg/seccomp/default_linux.go
+++ b/vendor/github.com/containers/common/pkg/seccomp/default_linux.go
@@ -51,14 +51,9 @@ func DefaultProfile() *Seccomp {
{
Names: []string{
"bdflush",
- "clone3",
"io_pgetevents",
- "io_uring_enter",
- "io_uring_register",
- "io_uring_setup",
"kexec_file_load",
"kexec_load",
- "membarrier",
"migrate_pages",
"move_pages",
"nfsservctl",
@@ -71,10 +66,6 @@ func DefaultProfile() *Seccomp {
"pciconfig_iobase",
"pciconfig_read",
"pciconfig_write",
- "pkey_alloc",
- "pkey_free",
- "pkey_mprotect",
- "rseq",
"sgetmask",
"ssetmask",
"swapcontext",
@@ -118,6 +109,7 @@ func DefaultProfile() *Seccomp {
"clock_nanosleep",
"clock_nanosleep_time64",
"clone",
+ "clone3",
"close",
"close_range",
"connect",
@@ -191,6 +183,7 @@ func DefaultProfile() *Seccomp {
"getgroups",
"getgroups32",
"getitimer",
+ "get_mempolicy",
"getpeername",
"getpgid",
"getpgrp",
@@ -241,6 +234,7 @@ func DefaultProfile() *Seccomp {
"lstat",
"lstat64",
"madvise",
+ "mbind",
"memfd_create",
"mincore",
"mkdir",
@@ -286,6 +280,9 @@ func DefaultProfile() *Seccomp {
"pipe",
"pipe2",
"pivot_root",
+ "pkey_alloc",
+ "pkey_free",
+ "pkey_mprotect",
"poll",
"ppoll",
"ppoll_time64",
@@ -318,6 +315,7 @@ func DefaultProfile() *Seccomp {
"renameat2",
"restart_syscall",
"rmdir",
+ "rseq",
"rt_sigaction",
"rt_sigpending",
"rt_sigprocmask",
@@ -354,6 +352,7 @@ func DefaultProfile() *Seccomp {
"sendmsg",
"sendto",
"setns",
+ "set_mempolicy",
"set_robust_list",
"set_thread_area",
"set_tid_address",
@@ -665,31 +664,6 @@ func DefaultProfile() *Seccomp {
},
{
Names: []string{
- "get_mempolicy",
- "mbind",
- "set_mempolicy",
- },
- Action: ActAllow,
- Args: []*Arg{},
- Includes: Filter{
- Caps: []string{"CAP_SYS_NICE"},
- },
- },
- {
- Names: []string{
- "get_mempolicy",
- "mbind",
- "set_mempolicy",
- },
- Action: ActErrno,
- ErrnoRet: &eperm,
- Args: []*Arg{},
- Excludes: Filter{
- Caps: []string{"CAP_SYS_NICE"},
- },
- },
- {
- Names: []string{
"acct",
},
Action: ActAllow,
diff --git a/vendor/github.com/containers/common/pkg/seccomp/seccomp.json b/vendor/github.com/containers/common/pkg/seccomp/seccomp.json
index 885240e50..eeb41d5d8 100644
--- a/vendor/github.com/containers/common/pkg/seccomp/seccomp.json
+++ b/vendor/github.com/containers/common/pkg/seccomp/seccomp.json
@@ -54,14 +54,9 @@
{
"names": [
"bdflush",
- "clone3",
"io_pgetevents",
- "io_uring_enter",
- "io_uring_register",
- "io_uring_setup",
"kexec_file_load",
"kexec_load",
- "membarrier",
"migrate_pages",
"move_pages",
"nfsservctl",
@@ -74,10 +69,6 @@
"pciconfig_iobase",
"pciconfig_read",
"pciconfig_write",
- "pkey_alloc",
- "pkey_free",
- "pkey_mprotect",
- "rseq",
"sgetmask",
"ssetmask",
"swapcontext",
@@ -124,6 +115,7 @@
"clock_nanosleep",
"clock_nanosleep_time64",
"clone",
+ "clone3",
"close",
"close_range",
"connect",
@@ -197,6 +189,7 @@
"getgroups",
"getgroups32",
"getitimer",
+ "get_mempolicy",
"getpeername",
"getpgid",
"getpgrp",
@@ -247,6 +240,7 @@
"lstat",
"lstat64",
"madvise",
+ "mbind",
"memfd_create",
"mincore",
"mkdir",
@@ -292,6 +286,9 @@
"pipe",
"pipe2",
"pivot_root",
+ "pkey_alloc",
+ "pkey_free",
+ "pkey_mprotect",
"poll",
"ppoll",
"ppoll_time64",
@@ -324,6 +321,7 @@
"renameat2",
"restart_syscall",
"rmdir",
+ "rseq",
"rt_sigaction",
"rt_sigpending",
"rt_sigprocmask",
@@ -360,6 +358,7 @@
"sendmsg",
"sendto",
"setns",
+ "set_mempolicy",
"set_robust_list",
"set_thread_area",
"set_tid_address",
@@ -761,39 +760,6 @@
},
{
"names": [
- "get_mempolicy",
- "mbind",
- "set_mempolicy"
- ],
- "action": "SCMP_ACT_ALLOW",
- "args": [],
- "comment": "",
- "includes": {
- "caps": [
- "CAP_SYS_NICE"
- ]
- },
- "excludes": {}
- },
- {
- "names": [
- "get_mempolicy",
- "mbind",
- "set_mempolicy"
- ],
- "action": "SCMP_ACT_ERRNO",
- "args": [],
- "comment": "",
- "includes": {},
- "excludes": {
- "caps": [
- "CAP_SYS_NICE"
- ]
- },
- "errnoRet": 1
- },
- {
- "names": [
"acct"
],
"action": "SCMP_ACT_ALLOW",
diff --git a/vendor/github.com/containers/common/version/version.go b/vendor/github.com/containers/common/version/version.go
index 6c899987a..8907e21ab 100644
--- a/vendor/github.com/containers/common/version/version.go
+++ b/vendor/github.com/containers/common/version/version.go
@@ -1,4 +1,4 @@
package version
// Version is the version of the build.
-const Version = "0.40.1-dev"
+const Version = "0.40.2-dev"
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 282b6ba66..c4cfc0d83 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -93,7 +93,7 @@ github.com/containers/buildah/pkg/overlay
github.com/containers/buildah/pkg/parse
github.com/containers/buildah/pkg/rusage
github.com/containers/buildah/util
-# github.com/containers/common v0.40.1-0.20210617134614-c6578d76fb0d
+# github.com/containers/common v0.40.2-0.20210623133759-d13a31743aec
github.com/containers/common/libimage
github.com/containers/common/libimage/manifests
github.com/containers/common/pkg/apparmor