summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile12
-rw-r--r--cmd/podman/common/completion.go7
-rw-r--r--cmd/podman/common/netflags.go2
-rw-r--r--cmd/podman/common/util.go4
-rw-r--r--cmd/podman/containers/checkpoint.go27
-rw-r--r--cmd/podman/containers/restore.go24
-rw-r--r--contrib/spec/podman.spec.in2
-rw-r--r--docs/MANPAGE_SYNTAX.md59
-rw-r--r--docs/source/markdown/podman-attach.1.md36
-rw-r--r--docs/source/markdown/podman-auto-update.1.md55
-rw-r--r--docs/source/markdown/podman-commit.1.md46
-rw-r--r--docs/source/markdown/podman-container-checkpoint.1.md52
-rw-r--r--docs/source/markdown/podman-container-restore.1.md15
-rw-r--r--docs/tutorials/mac_experimental.md99
-rw-r--r--docs/tutorials/podman-go-bindings.md12
-rw-r--r--docs/tutorials/remote_client.md4
-rw-r--r--libpod/container_api.go4
-rw-r--r--libpod/container_internal_linux.go2
-rw-r--r--pkg/api/handlers/compat/resize.go15
-rw-r--r--pkg/api/server/register_containers.go2
-rw-r--r--pkg/api/server/register_networks.go4
-rw-r--r--pkg/bindings/containers/attach.go54
-rw-r--r--pkg/checkpoint/checkpoint_restore.go9
-rw-r--r--pkg/domain/entities/containers.go3
-rw-r--r--pkg/domain/entities/events.go28
-rw-r--r--pkg/domain/infra/abi/containers.go1
-rw-r--r--pkg/specgen/generate/pod_create.go2
-rw-r--r--pkg/specgen/generate/ports.go4
-rw-r--r--pkg/systemd/generate/common.go11
-rw-r--r--pkg/systemd/generate/common_test.go24
-rw-r--r--pkg/systemd/generate/containers.go32
-rw-r--r--pkg/systemd/generate/containers_test.go130
-rw-r--r--test/apiv2/python/rest_api/fixtures/api_testcase.py2
-rw-r--r--test/apiv2/python/rest_api/test_v2_0_0_container.py4
-rw-r--r--test/e2e/checkpoint_test.go154
-rw-r--r--test/e2e/events_test.go13
-rw-r--r--test/e2e/generate_systemd_test.go4
-rw-r--r--test/system/090-events.bats1
-rw-r--r--test/system/255-auto-update.bats279
-rw-r--r--test/system/450-interactive.bats3
-rw-r--r--troubleshooting.md29
-rw-r--r--version/version.go2
42 files changed, 958 insertions, 314 deletions
diff --git a/Makefile b/Makefile
index 15d6d9fb6..4a7c727de 100644
--- a/Makefile
+++ b/Makefile
@@ -428,8 +428,16 @@ pkg/api/swagger.yaml: .gopathok
make -C pkg/api
$(MANPAGES): %: %.md .install.md2man docdir
- @sed -e 's/\((podman[^)]*\.md)\)//g' -e 's/\[\(podman[^]]*\)\]/\1/g' \
- -e 's;<\(/\)\?\(a\|a\s\+[^>]*\|sup\)>;;g' $< | \
+
+### sed is used to filter http/s links as well as relative links
+### replaces "\" at the end of a line with two spaces
+### this ensures that manpages are renderd correctly
+
+ @sed -e 's/\((podman[^)]*\.md\(#.*\)\?)\)//g' \
+ -e 's/\[\(podman[^]]*\)\]/\1/g' \
+ -e 's/\[\([^]]*\)](http[^)]\+)/\1/g' \
+ -e 's;<\(/\)\?\(a\|a\s\+[^>]*\|sup\)>;;g' \
+ -e 's/\\$// /g' $< | \
$(GOMD2MAN) -in /dev/stdin -out $(subst source/markdown,build/man,$@)
.PHONY: docdir
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index de5b2995a..c93f2017c 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -1211,3 +1211,10 @@ func AutocompleteVolumeFilters(cmd *cobra.Command, args []string, toComplete str
}
return completeKeyValues(toComplete, kv)
}
+
+// AutocompleteCheckpointCompressType - Autocomplete checkpoint compress type options.
+// -> "gzip", "none", "zstd"
+func AutocompleteCheckpointCompressType(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ types := []string{"gzip", "none", "zstd"}
+ return types, cobra.ShellCompDirectiveNoFileComp
+}
diff --git a/cmd/podman/common/netflags.go b/cmd/podman/common/netflags.go
index 4f634f355..78cfe2f13 100644
--- a/cmd/podman/common/netflags.go
+++ b/cmd/podman/common/netflags.go
@@ -170,7 +170,7 @@ func NetFlagsToNetOptions(cmd *cobra.Command, netnsFromConfig bool) (*entities.N
return nil, err
}
if len(inputPorts) > 0 {
- opts.PublishPorts, err = createPortBindings(inputPorts)
+ opts.PublishPorts, err = CreatePortBindings(inputPorts)
if err != nil {
return nil, err
}
diff --git a/cmd/podman/common/util.go b/cmd/podman/common/util.go
index afee55914..6a0af4dff 100644
--- a/cmd/podman/common/util.go
+++ b/cmd/podman/common/util.go
@@ -89,8 +89,8 @@ func createExpose(expose []string) (map[uint16]string, error) {
return toReturn, nil
}
-// createPortBindings iterates ports mappings into SpecGen format.
-func createPortBindings(ports []string) ([]specgen.PortMapping, error) {
+// CreatePortBindings iterates ports mappings into SpecGen format.
+func CreatePortBindings(ports []string) ([]specgen.PortMapping, error) {
// --publish is formatted as follows:
// [[hostip:]hostport[-endPort]:]containerport[-endPort][/protocol]
toReturn := make([]specgen.PortMapping, 0, len(ports))
diff --git a/cmd/podman/containers/checkpoint.go b/cmd/podman/containers/checkpoint.go
index 47d60453b..4fa72d520 100644
--- a/cmd/podman/containers/checkpoint.go
+++ b/cmd/podman/containers/checkpoint.go
@@ -3,6 +3,7 @@ package containers
import (
"context"
"fmt"
+ "strings"
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/common"
@@ -11,6 +12,7 @@ import (
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/rootless"
+ "github.com/containers/storage/pkg/archive"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -36,9 +38,7 @@ var (
}
)
-var (
- checkpointOptions entities.CheckpointOptions
-)
+var checkpointOptions entities.CheckpointOptions
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
@@ -60,11 +60,32 @@ func init() {
flags.BoolVarP(&checkpointOptions.PreCheckPoint, "pre-checkpoint", "P", false, "Dump container's memory information only, leave the container running")
flags.BoolVar(&checkpointOptions.WithPrevious, "with-previous", false, "Checkpoint container with pre-checkpoint images")
+ flags.StringP("compress", "c", "zstd", "Select compression algorithm (gzip, none, zstd) for checkpoint archive.")
+ _ = checkpointCommand.RegisterFlagCompletionFunc("compress", common.AutocompleteCheckpointCompressType)
+
validate.AddLatestFlag(checkpointCommand, &checkpointOptions.Latest)
}
func checkpoint(cmd *cobra.Command, args []string) error {
var errs utils.OutputErrors
+ if cmd.Flags().Changed("compress") {
+ if checkpointOptions.Export == "" {
+ return errors.Errorf("--compress can only be used with --export")
+ }
+ compress, _ := cmd.Flags().GetString("compress")
+ switch strings.ToLower(compress) {
+ case "none":
+ checkpointOptions.Compression = archive.Uncompressed
+ case "gzip":
+ checkpointOptions.Compression = archive.Gzip
+ case "zstd":
+ checkpointOptions.Compression = archive.Zstd
+ default:
+ return errors.Errorf("Selected compression algorithm (%q) not supported. Please select one from: gzip, none, zstd", compress)
+ }
+ } else {
+ checkpointOptions.Compression = archive.Zstd
+ }
if rootless.IsRootless() {
return errors.New("checkpointing a container requires root")
}
diff --git a/cmd/podman/containers/restore.go b/cmd/podman/containers/restore.go
index 3b1848abb..b908ea493 100644
--- a/cmd/podman/containers/restore.go
+++ b/cmd/podman/containers/restore.go
@@ -36,9 +36,7 @@ var (
}
)
-var (
- restoreOptions entities.RestoreOptions
-)
+var restoreOptions entities.RestoreOptions
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
@@ -66,10 +64,17 @@ func init() {
flags.BoolVar(&restoreOptions.IgnoreStaticIP, "ignore-static-ip", false, "Ignore IP address set via --static-ip")
flags.BoolVar(&restoreOptions.IgnoreStaticMAC, "ignore-static-mac", false, "Ignore MAC address set via --mac-address")
flags.BoolVar(&restoreOptions.IgnoreVolumes, "ignore-volumes", false, "Do not export volumes associated with container")
+
+ flags.StringSliceP(
+ "publish", "p", []string{},
+ "Publish a container's port, or a range of ports, to the host (default [])",
+ )
+ _ = restoreCommand.RegisterFlagCompletionFunc("publish", completion.AutocompleteNone)
+
validate.AddLatestFlag(restoreCommand, &restoreOptions.Latest)
}
-func restore(_ *cobra.Command, args []string) error {
+func restore(cmd *cobra.Command, args []string) error {
var errs utils.OutputErrors
if rootless.IsRootless() {
return errors.New("restoring a container requires root")
@@ -90,6 +95,17 @@ func restore(_ *cobra.Command, args []string) error {
return errors.Errorf("--tcp-established cannot be used with --name")
}
+ inputPorts, err := cmd.Flags().GetStringSlice("publish")
+ if err != nil {
+ return err
+ }
+ if len(inputPorts) > 0 {
+ restoreOptions.PublishPorts, err = common.CreatePortBindings(inputPorts)
+ if err != nil {
+ return err
+ }
+ }
+
argLen := len(args)
if restoreOptions.Import != "" {
if restoreOptions.All || restoreOptions.Latest {
diff --git a/contrib/spec/podman.spec.in b/contrib/spec/podman.spec.in
index 02b73bdb8..6146a2c0e 100644
--- a/contrib/spec/podman.spec.in
+++ b/contrib/spec/podman.spec.in
@@ -36,7 +36,7 @@ Epoch: 99
%else
Epoch: 0
%endif
-Version: 3.2.0
+Version: 3.3.0
Release: #COMMITDATE#.git%{shortcommit0}%{?dist}
Summary: Manage Pods, Containers and Container Images
License: ASL 2.0
diff --git a/docs/MANPAGE_SYNTAX.md b/docs/MANPAGE_SYNTAX.md
index 436ec5e8d..c9b677688 100644
--- a/docs/MANPAGE_SYNTAX.md
+++ b/docs/MANPAGE_SYNTAX.md
@@ -10,7 +10,7 @@ podman\-command - short description
**podman subcommand command** [*optional*] *mandatory value*
-(If there is the possibility to chose between 2 (two) or more mandatory command values. There should also always be a space before and after a vertical bar to ensure better readability.)
+(If there is the possibility to chose between two or more mandatory command values. There should also always be a space before and after a vertical bar to ensure better readability.)
**podman command** [*optional*] *value1* | *value2*
@@ -29,51 +29,68 @@ podman\-command - short description
**podman subcommand command** [*optional*] *value* [*value* ...]
## 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 a text retain their appearance and form.\
-Example sentence: The command **podman command** is an example command.\
-It should also be specified if the command can only be run as root. In addition, it should be described when a command or OPTION cannot be executed with the remote client. For a command, this should be done in the DESCRIPTION part. 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`.
+**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.
+
+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: You can 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`.
## 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**. Each OPTION should be explained to the fullest extend below the OPTION itself. Each OPTION is behind an H4-header (`####`).
+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: You can use **[podman-generate-systemd --new](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 the remote client, the sentence about the default argument should the second to last sentence.
+
-#### **--option**, **-o**
+#### **--version**, **-v**
-OPTIONS can be put after the command in two different ways. Eather 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 2 (two) versions of one command the long version is always shown in front.
+OPTIONS can be put after the command in two different ways. Eather 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*.
#### **--exit**
An example of an OPTION that has only one possible structure. Thus, it cannot be executed by the extension **-e**.
-#### **--answer**=, **-a**=**_active_** | *disable*
+#### **--answer**=, **-a**=**active** | *disable*
-OPTIONS that accept 2 possible arguments as inputs are shown above. If there is a default argument that is selected when no special input is made, it is shown in **_bold italics_**. It must always be ensured that the standard argument is in the first place after the OPTION. In this example, there are 2 (two) different versions to execute the command. Both versions of the OPTION have to be shown with the arguments behind them.
+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 for 3 (three) arguments behind an OPTION. If the number of arguments is higher than 3 (three), the arguments are **not** listed after the equal sign. The arguments have to be explained in a table like in **--test**=**_test_** regardless of the number of arguments.
+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**.
-#### **--test**=**_test_**
+#### **--test**=**test**
-OPTIONS that are followed by an equal sign include an argument after the equal sign in *italic*. If there is a default argument, that is used if the OPTION is not specified in the **command**, the argument after the eqaul 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**. If there is a default argument, that is used if the OPTION is not specified in the command, the argument after the eqaul sign is displayed in **bold**. All arguments must be listed and explained in the text below the OPTION.
| Argument | Description |
-| - | - |
-| **_example one_** | This argument is the standard argument if the OPTION is not specified. |
+| ------------------ | --------------------------------------------------------------------------- |
+| **example one** | This argument is the default argument if the OPTION is not specified. |
| *example two* | If one refers to a command, one should use **bold** marks. |
-| *example three* | Example: In combination with **podman command** highly effective. |
+| *example three* | Example: In combination with **podman command** highly effective. |
| *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 standard argument, it **must** listed as the first entry in the table.
+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 4 (four) they have to be listed behind the OPTION as seen in the OPTION **--status**.
+
+If the number of arguments is smaller than four they have to be listed behind the OPTION as seen in the OPTION **--status**.
+
+#### **--problem**=*problem*
+
+OPTIONS that are followed by an equal sign that is then followed by an unspecified argument, have no default argument. If this OPTION is written with an equal sign and the argument is left empty, there will be no error, but the OPTION will be ignored. The meaning of the argument is described preferably in `one` word after the equal sign in *italic* format.
## SUBCHAPTER
For chapters that are made specifically as an individual SUBCHAPTER in a man page, the previous conditions regarding formatting apply.
There are no restrictions for the use of paragraphs and tables. Within these paragraphs and tables the previous conditions regarding formatting apply.
-Strings of characters or numbers can be highlighted with `backticks`. Paths of any kind **must** be highlighted.\
+Strings of characters or numbers can be highlighted with `backticks`. Paths of any kind **must** be highlighted.
+
IMPORTANT: Only characters that are **not** part of categories mentioned before can be highlighted. This includes headers. For example it is not advised to highlight an OPTION or a **command**.
SUBHEADINGS are displayed as follows:
@@ -81,9 +98,9 @@ SUBHEADINGS are displayed as follows:
Text for SUBHEADINGS.
## EXAMPLES
-All EXAMPLES are listed in this section. This section should be at the end of each man page. Each EXAMPLE is always in one box. The box starts and ends with the last written line, **not** with a blank line. The `$` in front of the commands indicates that it can be run as a normal user, while the commands starting with `#` can only be run as root.
+All EXAMPLES are listed in this section. This section should be at the end of each man page. Each EXAMPLE is always in one box. The box starts and ends with the last written line, **not** with a blank line. The `$` in front of the commands indicates that it can be run as a normal user, while the commands starting with `#` can only be run as root. If there is the need for a comment in a box the comment should have `###` in front of it.
-### Description of the EXAMPLE
+Description of the EXAMPLE
```
$ podman command
@@ -92,7 +109,7 @@ $ podman command -o
$ cat $HOME/Dockerfile | podman command --option
```
-### Description of the EXAMPLE 2
+Description of the EXAMPLE two
```
$ podman command --redhat
diff --git a/docs/source/markdown/podman-attach.1.md b/docs/source/markdown/podman-attach.1.md
index c4a5eec50..092772916 100644
--- a/docs/source/markdown/podman-attach.1.md
+++ b/docs/source/markdown/podman-attach.1.md
@@ -9,48 +9,48 @@ podman\-attach - Attach to a running container
**podman container attach** [*options*] *container*
## DESCRIPTION
-The attach command allows you to attach to a running container using the container's ID
-or name, either to view its ongoing output or to control it interactively.
-
-You can detach from the container (and leave it running) using a configurable key sequence. The default
-sequence is `ctrl-p,ctrl-q`.
-Configure the keys sequence using the **--detach-keys** option, or specifying
-it in the **containers.conf** file: see **containers.conf(5)** for more information.
+**podman attach** attaches to a running *container* using the *container's name* or *ID*, to either view its ongoing output or to control it interactively.\
+The *container* can detached from (and leave it running) using a configurable key sequence. The default sequence is `ctrl-p,ctrl-q`. Configure the keys sequence using the **--detach-keys** option, or specifying it in the `containers.conf` file: see **[containers.conf(5)](https://github.com/containers/common/blob/master/docs/containers.conf.5.md)** for more information.
## OPTIONS
-#### **--detach-keys**=*sequence*
+#### **--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 you use methods other than Podman
-to run containers such as CRI-O, the last started container could be from either of those methods. (This option is not available with the remote Podman client)
+Instead of providing the *container name* or *ID*, 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*
#### **--no-stdin**
-Do not attach STDIN. The default is false.
+Do not attach STDIN. The default is **false**.
-#### **--sig-proxy**=*true*|*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
-[root@localhost /]#
```
+
+Attach to the latest created container.
```
$ podman attach --latest
-[root@localhost /]#
```
+
+Attach to a container that start with the ID "1234".
```
$ podman attach 1234
-[root@localhost /]#
```
+
+Attach to a container without attaching STDIN.
```
$ podman attach --no-stdin foobar
```
+
## SEE ALSO
-podman(1), podman-exec(1), podman-run(1), containers.conf(5)
+**[podman(1)](podman.1.md)**, **[podman-exec(1)](podman-exec.1.md)**, **[podman-run(1)](podman-run.1.md)**, **[containers.conf(5)](https://github.com/containers/common/blob/master/docs/containers.conf.5.md)**
diff --git a/docs/source/markdown/podman-auto-update.1.md b/docs/source/markdown/podman-auto-update.1.md
index 087c56360..52a9a3fec 100644
--- a/docs/source/markdown/podman-auto-update.1.md
+++ b/docs/source/markdown/podman-auto-update.1.md
@@ -1,16 +1,16 @@
% podman-auto-update(1)
## NAME
-podman-auto-update - Auto update containers according to their auto-update policy
+podman\-auto-update - Auto update containers according to their auto-update policy
## SYNOPSIS
**podman auto-update** [*options*]
## DESCRIPTION
-`podman auto-update` looks up containers with a specified "io.containers.autoupdate" label (i.e., the auto-update policy).
+**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.
@@ -18,60 +18,57 @@ The registry policy requires a fully-qualified image reference (e.g., quay.io/po
This enforcement is necessary to know which image to actually check and pull.
If an image ID was used, Podman would not know which image to check/pull anymore.
-Alternatively, if the autoupdate label is set to "local", Podman will compare the image a container is using to the image with it's raw name in local storage.
+Alternatively, if the autoupdate label is set to `local`, Podman will compare the image a container is using to the image with its raw name in local storage.
If an image is updated locally, Podman simply restarts the systemd unit executing the container.
-If "io.containers.autoupdate.authfile" label is present, Podman reaches out to corresponding authfile when pulling images.
+If `io.containers.autoupdate.authfile` label is present, Podman reaches out to the corresponding authfile when pulling images.
-At container-creation time, Podman looks up the "PODMAN_SYSTEMD_UNIT" environment variables and stores it verbatim in the container's label.
-This variable is now set by all systemd units generated by `podman-generate-systemd` and is set to `%n` (i.e., the name of systemd unit starting the container).
+At container-creation time, Podman looks up the `PODMAN_SYSTEMD_UNIT` environment variable and stores it verbatim in the container's label.
+This variable is now set by all systemd units generated by **[podman-generate-systemd](podman-generate-systemd.1.md)** and is set to `%n` (i.e., the name of systemd unit starting the container).
This data is then being used in the auto-update sequence to instruct systemd (via DBUS) to restart the unit and hence to restart the container.
-Note that `podman auto-update` relies on systemd. The systemd units are expected to be generated with `podman-generate-systemd --new`, or similar units that create new containers in order to run the updated images.
+Note that **podman auto-update** relies on systemd. The systemd units are expected to be generated with **[podman-generate-systemd --new](podman-generate-systemd.1.md#--new)**, or similar units that create new containers in order to run the updated images.
Systemd units that start and stop a container cannot run a new image.
-
### Systemd Unit and Timer
-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`.
-
+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`.
-If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using `docker login`.
+Path of the authentication file. Default is `${XDG_RUNTIME_DIR}/containers/auth.json`, which is set using **[podman login](podman-login.1.md)**.
+If the authorization state is not found there, `$HOME/.docker/config.json` is checked, which is set using **docker login**.
-Note: You can also override the default path of the authentication file by setting the REGISTRY\_AUTH\_FILE
-environment variable. `export REGISTRY_AUTH_FILE=path`
+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
```
-# Start a container
+### Start a container
$ podman run --label "io.containers.autoupdate=registry" \
--label "io.containers.autoupdate.authfile=/some/authfile.json" \
-d busybox:latest top
bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d
-# Generate a systemd unit for this container
+### Generate a systemd unit for this container
$ podman generate systemd --new --files bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d
/home/user/containers/libpod/container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service
-# Load the new systemd unit and start it
+### Load the new systemd unit and start it
$ mv ./container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service ~/.config/systemd/user
$ systemctl --user daemon-reload
-# If the previously created containers or pods are using shared resources, such as ports, make sure to remove them before starting the generated systemd units.
+### If the previously created containers or pods are using shared resources, such as ports, make sure to remove them before starting the generated systemd units.
$ podman stop bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d
$ podman rm bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d
$ systemctl --user start container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service
-# Auto-update the container
+### Auto-update the container
$ podman auto-update
container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service
```
@@ -79,37 +76,37 @@ container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.servi
Autoupdate with local policy
```
-# Start a container
+### Start a container
$ podman run --label "io.containers.autoupdate=local" \
-d busybox:latest top
be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338
-# Generate a systemd unit for this container
+### Generate a systemd unit for this container
$ podman generate systemd --new --files be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338
/home/user/containers/libpod/container-be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338.service
-# Load the new systemd unit and start it
+### Load the new systemd unit and start it
$ mv ./container-be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338.service ~/.config/systemd/user
$ systemctl --user daemon-reload
-# If the previously created containers or pods are using shared resources, such as ports, make sure to remove them before starting the generated systemd units.
+### If the previously created containers or pods are using shared resources, such as ports, make sure to remove them before starting the generated systemd units.
$ podman stop be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338
$ podman rm be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338
$ systemctl --user start container-be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338.service
-# Get the name of the container
+### Get the name of the container
$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
01f5c8113e84 docker.io/library/busybox:latest top 2 seconds ago Up 3 seconds ago inspiring_galileo
-# Modify the image
+### Modify the image
$ podman commit --change CMD=/bin/bash inspiring_galileo busybox:latest
-# Auto-update the container
+### Auto-update the container
$ podman auto-update
container-be0889fd06f252a2e5141b37072c6bada68563026cb2b2649f53394d87ccc338.service
```
## SEE ALSO
-podman(1), podman-generate-systemd(1), podman-run(1), systemd.unit(5)
+**[podman(1)](podman.1.md)**, **[podman-generate-systemd(1)](podman-generate-systemd.1.md)**, **[podman-run(1)](podman-run.1.md)**, systemd.unit(5)
diff --git a/docs/source/markdown/podman-commit.1.md b/docs/source/markdown/podman-commit.1.md
index 7485e9bd9..92574cdc5 100644
--- a/docs/source/markdown/podman-commit.1.md
+++ b/docs/source/markdown/podman-commit.1.md
@@ -9,34 +9,27 @@ podman\-commit - Create new image based on the changed container
**podman container commit** [*options*] *container* [*image*]
## DESCRIPTION
-**podman commit** creates an image based on a changed container. The author of the
-image can be set using the `--author` flag. Various image instructions can be
-configured with the `--change` flag and a commit message can be set using the
-`--message` flag. The container and its processes are paused while the image is
-committed. This minimizes the likelihood of data corruption when creating the new
-image. If this is not desired, the `--pause` flag can be set to false. When the commit
-is complete, Podman will print out the ID of the new image.
+**podman commit** creates an image based on a changed *container*. The author of the image can be set using the **--author** OPTION. Various image instructions can be configured with the **--change** OPTION and a commit message can be set using the **--message** OPTION. The *container* and its processes are paused while the image is committed. This minimizes the likelihood of data corruption when creating the new image. If this is not desired, the **--pause** OPTION can be set to *false*. When the commit is complete, Podman will print out the ID of the new image.
-If *image* does not begin with a registry name component, `localhost` will be added to the name.
-If *image* is not provided, the values for the `REPOSITORY` and `TAG` values of the created image will each be set to `<none>`.
+If `image` does not begin with a registry name component, `localhost` will be added to the name.
+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
+Set the author for the committed image.
#### **--change**, **-c**=*instruction*
Apply the following possible instructions to the created image:
**CMD** | **ENTRYPOINT** | **ENV** | **EXPOSE** | **LABEL** | **ONBUILD** | **STOPSIGNAL** | **USER** | **VOLUME** | **WORKDIR**
-Can be set multiple times
+Can be set multiple times.
-#### **--format**, **-f**=*format*
+#### **--format**, **-f** =**oci** | *docker*
-Set the format of the image manifest and metadata. The currently supported formats are _oci_ and _docker_. If
-not specifically set, the default format used 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*
@@ -44,23 +37,24 @@ 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` and `podman run` commands.
+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*
-Set commit message for committed image. The message field is not supported in _oci_ format.
+Set commit message for committed image.\
+*IMPORTANT: The message field is not supported in `oci` format.*
#### **--pause**, **-p**
-Pause the container when creating an image
+Pause the container when creating an image. The default is **false**.
#### **--quiet**, **-q**
-Suppress output
+Suppresses output. The default is **false**.
## EXAMPLES
-### Create image from container with entrypoint and label
+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
Getting image source signatures
@@ -73,39 +67,39 @@ Storing signatures
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
```
-### Create image from container with commit message
+Create image from container with commit message
```
$ podman commit -q --message "committing container to image"
reverent_golick image-committed
-e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8 ```
+e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
```
-### Create image from container with author
+Create image from container with author
```
$ podman commit -q --author "firstName lastName" reverent_golick image-committed
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
```
-### Pause a running container while creating the image
+Pause a running container while creating the image
```
$ podman commit -q --pause=true containerID image-committed
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
```
-### Create an image from a container with a default image tag
+Create an image from a container with a default image tag
```
$ podman commit containerID
e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
```
-### Create an image from container with default required capabilities are SETUID and SETGID
+Create an image from container with default required capabilities are SETUID and SETGID
```
$ podman commit -q --change LABEL=io.containers.capabilities=setuid,setgid epic_nobel privimage
400d31a3f36dca751435e80a0e16da4859beb51ff84670ce6bdc5edb30b94066
```
## SEE ALSO
-podman(1), podman-run(1), podman-create(1)
+**[podman(1)](podman.1.md)**, **[podman-run(1)](podman-run.1.md)**, **[podman-create(1)](podman-create.1.md)**
## HISTORY
December 2017, Originally compiled by Urvashi Mohnani <umohnani@redhat.com>
diff --git a/docs/source/markdown/podman-container-checkpoint.1.md b/docs/source/markdown/podman-container-checkpoint.1.md
index 46b6cb646..271a44c9d 100644
--- a/docs/source/markdown/podman-container-checkpoint.1.md
+++ b/docs/source/markdown/podman-container-checkpoint.1.md
@@ -10,31 +10,25 @@ podman\-container\-checkpoint - Checkpoints one or more running containers
Checkpoints all the processes in one or more containers. You may use container IDs or names as input.
## OPTIONS
-#### **--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.
-
#### **--all**, **-a**
Checkpoint all running containers.
-#### **--latest**, **-l**
-
-Instead of providing the container name or ID, checkpoint the last created container. (This option is not available with the remote Podman client)
-
-#### **--leave-running**, **-R**
+#### **--compress**, **-c**
-Leave the container running after checkpointing instead of stopping it.
+Specify the compression algorithm used for the checkpoint archive created
+with the **--export, -e** option. Possible algorithms are *gzip*, *none*
+and *zstd*. If no compression algorithm is specified Podman will use
+*zstd*.
-#### **--tcp-established**
+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.
-Checkpoint a container with established TCP connections. If the checkpoint
-image contains established TCP connections, this options is required during
-restore. Defaults to not checkpointing containers with established TCP
-connections.
+```
+# podman container checkpoint -l --compress=none --export=dump.tar
+# podman container checkpoint -l --compress=gzip --export=dump.tar.gz
+```
#### **--export**, **-e**
@@ -56,11 +50,33 @@ 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.
+#### **--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.
+
+#### **--latest**, **-l**
+
+Instead of providing the container name or ID, checkpoint the last created container. (This option is not available with the remote Podman client)
+
+#### **--leave-running**, **-R**
+
+Leave the container running after checkpointing instead of stopping it.
+
#### **--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.
+#### **--tcp-established**
+
+Checkpoint a container with established TCP connections. If the checkpoint
+image contains established TCP connections, this options is required during
+restore. Defaults to not checkpointing containers with established TCP
+connections.
+
#### **--with-previous**
Check out the container with previous criu image files in pre-dump. It only works
diff --git a/docs/source/markdown/podman-container-restore.1.md b/docs/source/markdown/podman-container-restore.1.md
index ef8722279..82bf76d1e 100644
--- a/docs/source/markdown/podman-container-restore.1.md
+++ b/docs/source/markdown/podman-container-restore.1.md
@@ -95,6 +95,19 @@ 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.
+#### **--publish**, **-p**
+
+Replaces the ports that the container publishes, as configured during the
+initial container start, with a new set of port forwarding rules.
+
+```
+# podman run --rm -p 2345:80 -d webserver
+# podman container checkpoint -l --export=dump.tar
+# podman container restore -p 5432:8080 --import=dump.tar
+```
+
+For more details please see **podman run --publish**.
+
## EXAMPLE
podman container restore mywebserver
@@ -104,7 +117,7 @@ podman container restore 860a4b23
podman container restore --import-previous pre-checkpoint.tar.gz --import checkpoint.tar.gz
## SEE ALSO
-podman(1), podman-container-checkpoint(1)
+podman(1), podman-container-checkpoint(1), podman-run(1)
## HISTORY
September 2018, Originally compiled by Adrian Reber <areber@redhat.com>
diff --git a/docs/tutorials/mac_experimental.md b/docs/tutorials/mac_experimental.md
new file mode 100644
index 000000000..8df64dc99
--- /dev/null
+++ b/docs/tutorials/mac_experimental.md
@@ -0,0 +1,99 @@
+# Using podman-machine on MacOS (x86_64 and Apple silicon)
+
+## Setup
+
+You must obtain a compressed tarball that contains the following:
+* a qcow image
+* a podman binary
+* a gvproxy binary
+
+You must also have installed brew prior to following this process. See https://brew.sh/ for
+installation instructions.
+
+Note: If your user has admin rights, you can ignore the use of `sudo` in these instructions.
+
+
+1. Install qemu from brew to obtain the required runtime dependencies.
+
+ ```
+ brew install qemu
+ ```
+
+2. If you are running MacOS on the Intel architecture, you can skip to step 8.
+3. Uninstall the brew package
+
+ ```
+ brew uninstall qemu
+ ```
+
+4. Get upstream qemu source code.
+
+ ```
+ git clone https://github.com/qemu/qemu
+ ```
+
+5. Apply patches that have not been merged into upstream qemu.
+
+ ```
+ cd qemu
+ git config user.name "YOUR_NAME"
+ git config user.email johndoe@example.com
+ git checkout v5.2.0
+ curl https://patchwork.kernel.org/series/418581/mbox/ | git am --exclude=MAINTAINERS
+ curl -L https://gist.github.com/citruz/9896cd6fb63288ac95f81716756cb9aa/raw/2d613e9a003b28dfe688f33055706d3873025a40/xcode-12-4.patch | git apply -
+ ```
+
+6. Install qemu build dependencies
+
+ ```
+ brew install libffi gettext pkg-config autoconf automake pixman ninja make
+ ```
+
+7. Configure, compile, and install qemu
+ ```
+ mkdir build
+ cd build
+ ../configure --target-list=aarch64-softmmu --disable-gnutls
+ gmake -j8
+ sudo gmake install
+ ```
+
+
+8. Uncompress and place provided binaries into filesystem
+
+ **Note**: In the following instructions, you need to know the name of the compressed file
+that you were given. It will be used in two of the steps below.
+
+ ```
+ cd ~
+ tar xvf `compressed_file_ending_in_xz`
+ sudo cp -v `unpacked_directory`/{gvproxy,podman} /usr/local/bin
+ ```
+
+9. Sign all binaries
+
+ If you have a Mac with Apple Silicon, issue the following command:
+ ```
+ sudo codesign --entitlements ~/qemu/accel/hvf/entitlements.plist --force -s - /usr/local/bin/qemu-* /usr/local/bin/gvproxy /usr/local/bin/podman
+ ```
+
+ If you have a Mac with an Intel processor, issue the following command:
+
+ ```
+ echo '<?xml version="1.0" encoding="utf-8"?>
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0"> <dict> <key>com.apple.security.hypervisor</key> <true/> </dict> </plist>
+ ' > ~/entitlements.plist
+ sudo codesign --entitlements ~/entitlements.plist --force -s - /usr/local/bin/qemu-* /usr/local/bin/gvproxy /usr/local/bin/podman
+ ```
+
+
+## Test podman
+
+1. podman machine init --image-path /path/to/image
+2. podman machine start
+3. podman images
+4. git clone http://github.com/baude/alpine_nginx && cd alpine_nginx
+5. podman build -t alpine_nginx .
+4. podman run -dt -p 9999:80 alpine_nginx
+5. curl http://localhost:9999
diff --git a/docs/tutorials/podman-go-bindings.md b/docs/tutorials/podman-go-bindings.md
index a952f2dc0..2bbf4e5de 100644
--- a/docs/tutorials/podman-go-bindings.md
+++ b/docs/tutorials/podman-go-bindings.md
@@ -174,7 +174,7 @@ This binding takes three arguments:
```Go
// Pull Busybox image (Sample 1)
fmt.Println("Pulling Busybox image...")
- _, err = images.Pull(connText, "docker.io/busybox", entities.ImagePullOptions{})
+ _, err = images.Pull(connText, "docker.io/busybox", &images.PullOptions{})
if err != nil {
fmt.Println(err)
os.Exit(1)
@@ -183,7 +183,7 @@ This binding takes three arguments:
// Pull Fedora image (Sample 2)
rawImage := "registry.fedoraproject.org/fedora:latest"
fmt.Println("Pulling Fedora image...")
- _, err = images.Pull(connText, rawImage, entities.ImagePullOptions{})
+ _, err = images.Pull(connText, rawImage, &images.PullOptions{})
if err != nil {
fmt.Println(err)
os.Exit(1)
@@ -229,7 +229,7 @@ This binding takes three arguments:
```Go
// List images
- imageSummary, err := images.List(connText, nil, nil)
+ imageSummary, err := images.List(connText, &images.ListOptions{})
if err != nil {
fmt.Println(err)
os.Exit(1)
@@ -287,7 +287,7 @@ containers.Wait() takes three arguments:
// Container create
s := specgen.NewSpecGenerator(rawImage, false)
s.Terminal = true
- r, err := containers.CreateWithSpec(connText, s)
+ r, err := containers.CreateWithSpec(connText, s, nil)
if err != nil {
fmt.Println(err)
os.Exit(1)
@@ -302,7 +302,7 @@ containers.Wait() takes three arguments:
}
running := define.ContainerStateRunning
- _, err = containers.Wait(connText, r.ID, &running)
+ _, err = containers.Wait(connText, r.ID, &containers.WaitOptions{Condition: []define.ContainerStatus{running}})
if err != nil {
fmt.Println(err)
os.Exit(1)
@@ -346,7 +346,7 @@ containers.List() takes seven arguments:
```Go
// Container list
var latestContainers = 1
- containerLatestList, err := containers.List(connText, nil, nil, &latestContainers, nil, nil, nil)
+ containerLatestList, err := containers.List(connText, &containers.ListOptions{Last: &latestContainers})
if err != nil {
fmt.Println(err)
os.Exit(1)
diff --git a/docs/tutorials/remote_client.md b/docs/tutorials/remote_client.md
index e39d804a6..889947397 100644
--- a/docs/tutorials/remote_client.md
+++ b/docs/tutorials/remote_client.md
@@ -108,5 +108,9 @@ podman-remote system connection --help
You can use the Podman remote clients to manage your containers running on a Linux server. The communication between client and server relies heavily on SSH connections and the use of SSH keys are encouraged. Once you have Podman installed on your remote client, you should set up a connection using `podman-remote system connection add` which will then be used by subsequent Podman commands.
+# Troubleshooting
+
+See the [Troubleshooting](../../troubleshooting.md) document if you run into issues.
+
## History
Adapted from the [Mac and Windows tutorial](https://github.com/containers/podman/blob/master/docs/tutorials/mac_win_client.md)
diff --git a/libpod/container_api.go b/libpod/container_api.go
index 4ccb240e7..b75d0b41d 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/libpod/events"
"github.com/containers/podman/v3/pkg/signal"
+ "github.com/containers/storage/pkg/archive"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -776,6 +777,9 @@ type ContainerCheckpointOptions struct {
// ImportPrevious tells the API to restore container with two
// images. One is TargetFile, the other is ImportPrevious.
ImportPrevious string
+ // Compression tells the API which compression to use for
+ // the exported checkpoint archive.
+ Compression archive.Compression
}
// Checkpoint checkpoints a container
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 74a3fec32..a3acc3198 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -985,7 +985,7 @@ func (c *Container) exportCheckpoint(options ContainerCheckpointOptions) error {
}
input, err := archive.TarWithOptions(c.bundlePath(), &archive.TarOptions{
- Compression: archive.Gzip,
+ Compression: options.Compression,
IncludeSourceDir: true,
IncludeFiles: includeFiles,
})
diff --git a/pkg/api/handlers/compat/resize.go b/pkg/api/handlers/compat/resize.go
index 23ed33a22..f65e313fc 100644
--- a/pkg/api/handlers/compat/resize.go
+++ b/pkg/api/handlers/compat/resize.go
@@ -46,20 +46,13 @@ func ResizeTTY(w http.ResponseWriter, r *http.Request) {
utils.ContainerNotFound(w, name, err)
return
}
- if state, err := ctnr.State(); err != nil {
- utils.InternalServerError(w, errors.Wrapf(err, "cannot obtain container state"))
- return
- } else if state != define.ContainerStateRunning && !query.IgnoreNotRunning {
- utils.Error(w, "Container not running", http.StatusConflict,
- fmt.Errorf("container %q in wrong state %q", name, state.String()))
- return
- }
- // If container is not running, ignore since this can be a race condition, and is expected
if err := ctnr.AttachResize(sz); err != nil {
- if errors.Cause(err) != define.ErrCtrStateInvalid || !query.IgnoreNotRunning {
+ if errors.Cause(err) != define.ErrCtrStateInvalid {
utils.InternalServerError(w, errors.Wrapf(err, "cannot resize container"))
- return
+ } else {
+ utils.Error(w, "Container not running", http.StatusConflict, err)
}
+ return
}
// This is not a 204, even though we write nothing, for compatibility
// reasons.
diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go
index aa999905e..88ebb4df5 100644
--- a/pkg/api/server/register_containers.go
+++ b/pkg/api/server/register_containers.go
@@ -1364,6 +1364,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// $ref: "#/responses/ok"
// 404:
// $ref: "#/responses/NoSuchContainer"
+ // 409:
+ // $ref: "#/responses/ConflictError"
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/libpod/containers/{name}/resize"), s.APIHandler(compat.ResizeTTY)).Methods(http.MethodPost)
diff --git a/pkg/api/server/register_networks.go b/pkg/api/server/register_networks.go
index 9a5ccb789..4d9806316 100644
--- a/pkg/api/server/register_networks.go
+++ b/pkg/api/server/register_networks.go
@@ -241,7 +241,9 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error {
// tags:
// - networks
// summary: List networks
- // description: Display summary of network configurations
+ // description: |
+ // Display summary of network configurations.
+ // - In a 200 response, all of the fields named Bytes are returned as a Base64 encoded string.
// parameters:
// - in: query
// name: filters
diff --git a/pkg/bindings/containers/attach.go b/pkg/bindings/containers/attach.go
index fd8a7011d..adef1e7c8 100644
--- a/pkg/bindings/containers/attach.go
+++ b/pkg/bindings/containers/attach.go
@@ -138,7 +138,7 @@ func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Wri
winCtx, winCancel := context.WithCancel(ctx)
defer winCancel()
- go attachHandleResize(ctx, winCtx, winChange, false, nameOrID, file)
+ attachHandleResize(ctx, winCtx, winChange, false, nameOrID, file)
}
// If we are attaching around a start, we need to "signal"
@@ -327,32 +327,38 @@ func (f *rawFormatter) Format(entry *logrus.Entry) ([]byte, error) {
return append(buffer, '\r'), nil
}
-// This is intended to be run as a goroutine, handling resizing for a container
-// or exec session.
+// This is intended to not be run as a goroutine, handling resizing for a container
+// or exec session. It will call resize once and then starts a goroutine which calls resize on winChange
func attachHandleResize(ctx, winCtx context.Context, winChange chan os.Signal, isExec bool, id string, file *os.File) {
- // Prime the pump, we need one reset to ensure everything is ready
- winChange <- sig.SIGWINCH
- for {
- select {
- case <-winCtx.Done():
- return
- case <-winChange:
- w, h, err := terminal.GetSize(int(file.Fd()))
- if err != nil {
- logrus.Warnf("failed to obtain TTY size: %v", err)
- }
+ resize := func() {
+ w, h, err := terminal.GetSize(int(file.Fd()))
+ if err != nil {
+ logrus.Warnf("failed to obtain TTY size: %v", err)
+ }
- var resizeErr error
- if isExec {
- resizeErr = ResizeExecTTY(ctx, id, new(ResizeExecTTYOptions).WithHeight(h).WithWidth(w))
- } else {
- resizeErr = ResizeContainerTTY(ctx, id, new(ResizeTTYOptions).WithHeight(h).WithWidth(w))
- }
- if resizeErr != nil {
- logrus.Warnf("failed to resize TTY: %v", resizeErr)
- }
+ var resizeErr error
+ if isExec {
+ resizeErr = ResizeExecTTY(ctx, id, new(ResizeExecTTYOptions).WithHeight(h).WithWidth(w))
+ } else {
+ resizeErr = ResizeContainerTTY(ctx, id, new(ResizeTTYOptions).WithHeight(h).WithWidth(w))
+ }
+ if resizeErr != nil {
+ logrus.Warnf("failed to resize TTY: %v", resizeErr)
}
}
+
+ resize()
+
+ go func() {
+ for {
+ select {
+ case <-winCtx.Done():
+ return
+ case <-winChange:
+ resize()
+ }
+ }
+ }()
}
// Configure the given terminal for raw mode
@@ -457,7 +463,7 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, options *ExecStar
winCtx, winCancel := context.WithCancel(ctx)
defer winCancel()
- go attachHandleResize(ctx, winCtx, winChange, true, sessionID, terminalFile)
+ attachHandleResize(ctx, winCtx, winChange, true, sessionID, terminalFile)
}
if options.GetAttachInput() {
diff --git a/pkg/checkpoint/checkpoint_restore.go b/pkg/checkpoint/checkpoint_restore.go
index 7a8f71c66..0d45cab5f 100644
--- a/pkg/checkpoint/checkpoint_restore.go
+++ b/pkg/checkpoint/checkpoint_restore.go
@@ -11,6 +11,7 @@ import (
"github.com/containers/podman/v3/libpod"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/errorhandling"
+ "github.com/containers/podman/v3/pkg/specgen/generate"
"github.com/containers/storage/pkg/archive"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
@@ -95,6 +96,14 @@ func CRImportCheckpoint(ctx context.Context, runtime *libpod.Runtime, restoreOpt
newName = true
}
+ if len(restoreOptions.PublishPorts) > 0 {
+ ports, _, _, err := generate.ParsePortMapping(restoreOptions.PublishPorts)
+ if err != nil {
+ return nil, err
+ }
+ ctrConfig.PortMappings = ports
+ }
+
pullOptions := &libimage.PullOptions{}
pullOptions.Writer = os.Stderr
if _, err := runtime.LibimageRuntime().Pull(ctx, ctrConfig.RootfsImageName, config.PullPolicyMissing, pullOptions); err != nil {
diff --git a/pkg/domain/entities/containers.go b/pkg/domain/entities/containers.go
index eacc14d50..8ed9b9b61 100644
--- a/pkg/domain/entities/containers.go
+++ b/pkg/domain/entities/containers.go
@@ -9,6 +9,7 @@ import (
"github.com/containers/image/v5/types"
"github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/pkg/specgen"
+ "github.com/containers/storage/pkg/archive"
"github.com/cri-o/ocicni/pkg/ocicni"
)
@@ -178,6 +179,7 @@ type CheckpointOptions struct {
TCPEstablished bool
PreCheckPoint bool
WithPrevious bool
+ Compression archive.Compression
}
type CheckpointReport struct {
@@ -197,6 +199,7 @@ type RestoreOptions struct {
Name string
TCPEstablished bool
ImportPrevious string
+ PublishPorts []specgen.PortMapping
}
type RestoreReport struct {
diff --git a/pkg/domain/entities/events.go b/pkg/domain/entities/events.go
index 930ca53ae..5e7cc9ad1 100644
--- a/pkg/domain/entities/events.go
+++ b/pkg/domain/entities/events.go
@@ -30,29 +30,41 @@ func ConvertToLibpodEvent(e Event) *libpodEvents.Event {
if err != nil {
return nil
}
+ image := e.Actor.Attributes["image"]
+ name := e.Actor.Attributes["name"]
+ details := e.Actor.Attributes
+ delete(details, "image")
+ delete(details, "name")
+ delete(details, "containerExitCode")
return &libpodEvents.Event{
ContainerExitCode: exitCode,
ID: e.Actor.ID,
- Image: e.Actor.Attributes["image"],
- Name: e.Actor.Attributes["name"],
+ Image: image,
+ Name: name,
Status: status,
Time: time.Unix(e.Time, e.TimeNano),
Type: t,
+ Details: libpodEvents.Details{
+ Attributes: details,
+ },
}
}
// ConvertToEntitiesEvent converts a libpod event to an entities one.
func ConvertToEntitiesEvent(e libpodEvents.Event) *Event {
+ attributes := e.Details.Attributes
+ if attributes == nil {
+ attributes = make(map[string]string)
+ }
+ attributes["image"] = e.Image
+ attributes["name"] = e.Name
+ attributes["containerExitCode"] = strconv.Itoa(e.ContainerExitCode)
return &Event{dockerEvents.Message{
Type: e.Type.String(),
Action: e.Status.String(),
Actor: dockerEvents.Actor{
- ID: e.ID,
- Attributes: map[string]string{
- "image": e.Image,
- "name": e.Name,
- "containerExitCode": strconv.Itoa(e.ContainerExitCode),
- },
+ ID: e.ID,
+ Attributes: attributes,
},
Scope: "local",
Time: e.Time.Unix(),
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 237a43441..4908e72f6 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -483,6 +483,7 @@ func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds [
KeepRunning: options.LeaveRunning,
PreCheckPoint: options.PreCheckPoint,
WithPrevious: options.WithPrevious,
+ Compression: options.Compression,
}
if options.All {
diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go
index 20151f016..07c56b799 100644
--- a/pkg/specgen/generate/pod_create.go
+++ b/pkg/specgen/generate/pod_create.go
@@ -125,7 +125,7 @@ func createPodOptions(p *specgen.PodSpecGenerator, rt *libpod.Runtime) ([]libpod
options = append(options, libpod.WithPodUseImageHosts())
}
if len(p.PortMappings) > 0 {
- ports, _, _, err := parsePortMapping(p.PortMappings)
+ ports, _, _, err := ParsePortMapping(p.PortMappings)
if err != nil {
return nil, err
}
diff --git a/pkg/specgen/generate/ports.go b/pkg/specgen/generate/ports.go
index 8745f0dad..c00ad19fb 100644
--- a/pkg/specgen/generate/ports.go
+++ b/pkg/specgen/generate/ports.go
@@ -24,7 +24,7 @@ const (
// Parse port maps to OCICNI port mappings.
// Returns a set of OCICNI port mappings, and maps of utilized container and
// host ports.
-func parsePortMapping(portMappings []specgen.PortMapping) ([]ocicni.PortMapping, map[string]map[string]map[uint16]uint16, map[string]map[string]map[uint16]uint16, error) {
+func ParsePortMapping(portMappings []specgen.PortMapping) ([]ocicni.PortMapping, map[string]map[string]map[uint16]uint16, map[string]map[string]map[uint16]uint16, error) {
// First, we need to validate the ports passed in the specgen, and then
// convert them into CNI port mappings.
type tempMapping struct {
@@ -254,7 +254,7 @@ func parsePortMapping(portMappings []specgen.PortMapping) ([]ocicni.PortMapping,
// Make final port mappings for the container
func createPortMappings(ctx context.Context, s *specgen.SpecGenerator, imageData *libimage.ImageData) ([]ocicni.PortMapping, error) {
- finalMappings, containerPortValidate, hostPortValidate, err := parsePortMapping(s.PortMappings)
+ finalMappings, containerPortValidate, hostPortValidate, err := ParsePortMapping(s.PortMappings)
if err != nil {
return nil, err
}
diff --git a/pkg/systemd/generate/common.go b/pkg/systemd/generate/common.go
index 1ee070888..e183125a7 100644
--- a/pkg/systemd/generate/common.go
+++ b/pkg/systemd/generate/common.go
@@ -60,7 +60,7 @@ func filterPodFlags(command []string, argCount int) []string {
return processed
}
-// filterCommonContainerFlags removes --conmon-pidfile, --cidfile and --cgroups from the specified command.
+// filterCommonContainerFlags removes --sdnotify, --rm and --cgroups from the specified command.
// argCount is the number of last arguments which should not be filtered, e.g. the container entrypoint.
func filterCommonContainerFlags(command []string, argCount int) []string {
processed := []string{}
@@ -68,11 +68,14 @@ func filterCommonContainerFlags(command []string, argCount int) []string {
s := command[i]
switch {
- case s == "--conmon-pidfile", s == "--cidfile", s == "--cgroups":
+ case s == "--rm":
+ // Boolean flags support --flag and --flag={true,false}.
+ continue
+ case s == "--sdnotify", s == "--cgroups":
i++
continue
- case strings.HasPrefix(s, "--conmon-pidfile="),
- strings.HasPrefix(s, "--cidfile="),
+ case strings.HasPrefix(s, "--sdnotify="),
+ strings.HasPrefix(s, "--rm="),
strings.HasPrefix(s, "--cgroups="):
continue
}
diff --git a/pkg/systemd/generate/common_test.go b/pkg/systemd/generate/common_test.go
index fdcc9d21b..3e2ac015f 100644
--- a/pkg/systemd/generate/common_test.go
+++ b/pkg/systemd/generate/common_test.go
@@ -93,22 +93,22 @@ func TestFilterCommonContainerFlags(t *testing.T) {
},
{
[]string{"podman", "run", "--conmon-pidfile", "foo", "alpine"},
- []string{"podman", "run", "alpine"},
+ []string{"podman", "run", "--conmon-pidfile", "foo", "alpine"},
1,
},
{
[]string{"podman", "run", "--conmon-pidfile=foo", "alpine"},
- []string{"podman", "run", "alpine"},
+ []string{"podman", "run", "--conmon-pidfile=foo", "alpine"},
1,
},
{
[]string{"podman", "run", "--cidfile", "foo", "alpine"},
- []string{"podman", "run", "alpine"},
+ []string{"podman", "run", "--cidfile", "foo", "alpine"},
1,
},
{
[]string{"podman", "run", "--cidfile=foo", "alpine"},
- []string{"podman", "run", "alpine"},
+ []string{"podman", "run", "--cidfile=foo", "alpine"},
1,
},
{
@@ -122,25 +122,15 @@ func TestFilterCommonContainerFlags(t *testing.T) {
1,
},
{
- []string{"podman", "run", "--cgroups", "foo", "--conmon-pidfile", "foo", "--cidfile", "foo", "alpine"},
+ []string{"podman", "run", "--cgroups=foo", "--rm", "alpine"},
[]string{"podman", "run", "alpine"},
1,
},
{
- []string{"podman", "run", "--cgroups=foo", "--conmon-pidfile=foo", "--cidfile=foo", "alpine"},
- []string{"podman", "run", "alpine"},
- 1,
- },
- {
- []string{"podman", "run", "--cgroups", "foo", "--conmon-pidfile", "foo", "--cidfile", "foo", "alpine", "--cgroups", "foo", "--conmon-pidfile", "foo", "--cidfile", "foo"},
- []string{"podman", "run", "alpine", "--cgroups", "foo", "--conmon-pidfile", "foo", "--cidfile", "foo"},
+ []string{"podman", "run", "--cgroups", "--rm=bogus", "alpine", "--cgroups", "foo", "--conmon-pidfile", "foo", "--cidfile", "foo", "--rm"},
+ []string{"podman", "run", "alpine", "--cgroups", "foo", "--conmon-pidfile", "foo", "--cidfile", "foo", "--rm"},
7,
},
- {
- []string{"podman", "run", "--cgroups=foo", "--conmon-pidfile=foo", "--cidfile=foo", "alpine", "--cgroups=foo", "--conmon-pidfile=foo", "--cidfile=foo"},
- []string{"podman", "run", "alpine", "--cgroups=foo", "--conmon-pidfile=foo", "--cidfile=foo"},
- 4,
- },
}
for _, test := range tests {
diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go
index 72f321347..0e6e1b4df 100644
--- a/pkg/systemd/generate/containers.go
+++ b/pkg/systemd/generate/containers.go
@@ -25,6 +25,10 @@ type containerInfo struct {
ServiceName string
// Name or ID of the container.
ContainerNameOrID string
+ // Type of the unit.
+ Type string
+ // NotifyAccess of the unit.
+ NotifyAccess string
// StopTimeout sets the timeout Podman waits before killing the container
// during service stop.
StopTimeout uint
@@ -102,10 +106,19 @@ TimeoutStopSec={{{{.TimeoutStopSec}}}}
ExecStartPre={{{{.ExecStartPre}}}}
{{{{- end}}}}
ExecStart={{{{.ExecStart}}}}
+{{{{- if .ExecStop}}}}
ExecStop={{{{.ExecStop}}}}
+{{{{- end}}}}
+{{{{- if .ExecStopPost}}}}
ExecStopPost={{{{.ExecStopPost}}}}
+{{{{- end}}}}
+{{{{- if .PIDFile}}}}
PIDFile={{{{.PIDFile}}}}
-Type=forking
+{{{{- end}}}}
+Type={{{{.Type}}}}
+{{{{- if .NotifyAccess}}}}
+NotifyAccess={{{{.NotifyAccess}}}}
+{{{{- end}}}}
[Install]
WantedBy=multi-user.target default.target
@@ -208,6 +221,7 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
info.Executable = executable
}
+ info.Type = "forking"
info.EnvVariable = define.EnvVariable
info.ExecStart = "{{{{.Executable}}}} start {{{{.ContainerNameOrID}}}}"
info.ExecStop = "{{{{.Executable}}}} stop {{{{if (ge .StopTimeout 0)}}}}-t {{{{.StopTimeout}}}}{{{{end}}}} {{{{.ContainerNameOrID}}}}"
@@ -221,8 +235,12 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
// invalid `info.CreateCommand`. Hence, we're doing a best effort unit
// generation and don't try aiming at completeness.
if options.New {
- info.PIDFile = "%t/" + info.ServiceName + ".pid"
- info.ContainerIDFile = "%t/" + info.ServiceName + ".ctr-id"
+ info.Type = "notify"
+ info.NotifyAccess = "all"
+ info.PIDFile = ""
+ info.ContainerIDFile = ""
+ info.ExecStop = ""
+ info.ExecStopPost = ""
// The create command must at least have three arguments:
// /usr/bin/podman run $IMAGE
index := 0
@@ -245,9 +263,9 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
}
startCommand = append(startCommand,
"run",
- "--conmon-pidfile", "{{{{.PIDFile}}}}",
- "--cidfile", "{{{{.ContainerIDFile}}}}",
+ "--sdnotify=conmon",
"--cgroups=no-conmon",
+ "--rm",
)
remainingCmd := info.CreateCommand[index:]
@@ -336,11 +354,7 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
startCommand = append(startCommand, remainingCmd...)
startCommand = escapeSystemdArguments(startCommand)
-
- info.ExecStartPre = "/bin/rm -f {{{{.PIDFile}}}} {{{{.ContainerIDFile}}}}"
info.ExecStart = strings.Join(startCommand, " ")
- info.ExecStop = "{{{{.Executable}}}} {{{{if .RootFlags}}}}{{{{ .RootFlags}}}} {{{{end}}}}stop --ignore --cidfile {{{{.ContainerIDFile}}}} {{{{if (ge .StopTimeout 0)}}}}-t {{{{.StopTimeout}}}}{{{{end}}}}"
- info.ExecStopPost = "{{{{.Executable}}}} {{{{if .RootFlags}}}}{{{{ .RootFlags}}}} {{{{end}}}}rm --ignore -f --cidfile {{{{.ContainerIDFile}}}}"
}
info.TimeoutStopSec = minTimeoutStopSec + info.StopTimeout
diff --git a/pkg/systemd/generate/containers_test.go b/pkg/systemd/generate/containers_test.go
index b1070fa52..12a8f3004 100644
--- a/pkg/systemd/generate/containers_test.go
+++ b/pkg/systemd/generate/containers_test.go
@@ -130,12 +130,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman container run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon -d --replace --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN "foo=arg \"with \" space"
-ExecStop=/usr/bin/podman container stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 10
-ExecStopPost=/usr/bin/podman container rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman container run --sdnotify=conmon --cgroups=no-conmon --rm -d --replace --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN "foo=arg \"with \" space"
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -155,12 +152,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon --replace -d --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN
-ExecStop=/usr/bin/podman stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 10
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman run --sdnotify=conmon --cgroups=no-conmon --rm --replace -d --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -180,12 +174,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon --pod-id-file %t/pod-foobar.pod-id-file --replace -d --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN
-ExecStop=/usr/bin/podman stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 10
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman run --sdnotify=conmon --cgroups=no-conmon --rm --pod-id-file %t/pod-foobar.pod-id-file --replace -d --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -205,12 +196,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon --replace --detach --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN
-ExecStop=/usr/bin/podman stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 10
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman run --sdnotify=conmon --cgroups=no-conmon --rm --replace --detach --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -230,12 +218,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
-ExecStartPre=/bin/rm -f %t/container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.pid %t/container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.ctr-id
-ExecStart=/usr/bin/podman run --conmon-pidfile %t/container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.pid --cidfile %t/container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.ctr-id --cgroups=no-conmon -d awesome-image:latest
-ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.ctr-id -t 10
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.ctr-id
-PIDFile=%t/container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.pid
-Type=forking
+ExecStart=/usr/bin/podman run --sdnotify=conmon --cgroups=no-conmon --rm -d awesome-image:latest
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -256,14 +241,11 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=102
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon ` +
+ExecStart=/usr/bin/podman run --sdnotify=conmon --cgroups=no-conmon --rm ` +
detachparam +
` awesome-image:latest
-ExecStop=/usr/bin/podman stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 42
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -285,12 +267,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=102
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon -d --replace --name test -p 80:80 awesome-image:latest somecmd --detach=false
-ExecStop=/usr/bin/podman stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 42
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman run --sdnotify=conmon --cgroups=no-conmon --rm -d --replace --name test -p 80:80 awesome-image:latest somecmd --detach=false
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -310,12 +289,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=102
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman --events-backend none --runroot /root run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon -d awesome-image:latest
-ExecStop=/usr/bin/podman --events-backend none --runroot /root stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 42
-ExecStopPost=/usr/bin/podman --events-backend none --runroot /root rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman --events-backend none --runroot /root run --sdnotify=conmon --cgroups=no-conmon --rm -d awesome-image:latest
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -335,12 +311,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman container run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon -d awesome-image:latest
-ExecStop=/usr/bin/podman container stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 10
-ExecStopPost=/usr/bin/podman container rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman container run --sdnotify=conmon --cgroups=no-conmon --rm -d awesome-image:latest
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -360,12 +333,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon -d --replace --name test --log-driver=journald --log-opt=tag={{.Name}} awesome-image:latest
-ExecStop=/usr/bin/podman stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 10
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman run --sdnotify=conmon --cgroups=no-conmon --rm -d --replace --name test --log-driver=journald --log-opt=tag={{.Name}} awesome-image:latest
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -385,12 +355,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon -d --replace --name test awesome-image:latest sh -c "kill $$$$ && echo %%\\"
-ExecStop=/usr/bin/podman stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 10
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman run --sdnotify=conmon --cgroups=no-conmon --rm -d --replace --name test awesome-image:latest sh -c "kill $$$$ && echo %%\\"
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -410,12 +377,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon -d awesome-image:latest podman run --cgroups=foo --conmon-pidfile=foo --cidfile=foo alpine
-ExecStop=/usr/bin/podman stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 10
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman run --sdnotify=conmon --cgroups=no-conmon --rm -d --conmon-pidfile=foo --cidfile=foo awesome-image:latest podman run --cgroups=foo --conmon-pidfile=foo --cidfile=foo alpine
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -435,12 +399,9 @@ RequiresMountsFor=/var/run/containers/storage
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon --pod-id-file %t/pod-foobar.pod-id-file -d awesome-image:latest podman run --cgroups=foo --conmon-pidfile=foo --cidfile=foo --pod-id-file /tmp/pod-foobar.pod-id-file alpine
-ExecStop=/usr/bin/podman stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 10
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman run --sdnotify=conmon --cgroups=no-conmon --rm --pod-id-file %t/pod-foobar.pod-id-file -d --conmon-pidfile=foo --cidfile=foo awesome-image:latest podman run --cgroups=foo --conmon-pidfile=foo --cidfile=foo --pod-id-file /tmp/pod-foobar.pod-id-file alpine
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -461,12 +422,9 @@ Environment=PODMAN_SYSTEMD_UNIT=%n
Environment=FOO=abc "BAR=my test" USER=%%a
Restart=always
TimeoutStopSec=70
-ExecStartPre=/bin/rm -f %t/jadda-jadda.pid %t/jadda-jadda.ctr-id
-ExecStart=/usr/bin/podman run --conmon-pidfile %t/jadda-jadda.pid --cidfile %t/jadda-jadda.ctr-id --cgroups=no-conmon -d --env FOO --env=BAR --env=MYENV=2 -e USER awesome-image:latest
-ExecStop=/usr/bin/podman stop --ignore --cidfile %t/jadda-jadda.ctr-id -t 10
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/jadda-jadda.ctr-id
-PIDFile=%t/jadda-jadda.pid
-Type=forking
+ExecStart=/usr/bin/podman run --sdnotify=conmon --cgroups=no-conmon --rm -d --env FOO --env=BAR --env=MYENV=2 -e USER awesome-image:latest
+Type=notify
+NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
@@ -929,10 +887,10 @@ WantedBy=multi-user.target default.target
}
got, err := executeContainerTemplate(&test.info, opts)
if (err != nil) != test.wantErr {
- t.Errorf("CreateContainerSystemdUnit() error = \n%v, wantErr \n%v", err, test.wantErr)
+ t.Errorf("CreateContainerSystemdUnit() %s error = \n%v, wantErr \n%v", test.name, err, test.wantErr)
return
}
- assert.Equal(t, test.want, got)
+ assert.Equal(t, test.want, got, test.name)
})
}
}
diff --git a/test/apiv2/python/rest_api/fixtures/api_testcase.py b/test/apiv2/python/rest_api/fixtures/api_testcase.py
index 8b771774b..155e93928 100644
--- a/test/apiv2/python/rest_api/fixtures/api_testcase.py
+++ b/test/apiv2/python/rest_api/fixtures/api_testcase.py
@@ -49,7 +49,7 @@ class APITestCase(unittest.TestCase):
def setUp(self):
super().setUp()
- APITestCase.podman.run("run", "alpine", "/bin/ls", check=True)
+ APITestCase.podman.run("run", "-d", "alpine", "top", check=True)
def tearDown(self) -> None:
APITestCase.podman.run("pod", "rm", "--all", "--force", check=True)
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 f67013117..b4b3af2df 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
@@ -12,7 +12,7 @@ class ContainerTestCase(APITestCase):
r = requests.get(self.uri("/containers/json"), timeout=5)
self.assertEqual(r.status_code, 200, r.text)
obj = r.json()
- self.assertEqual(len(obj), 0)
+ self.assertEqual(len(obj), 1)
def test_list_all(self):
r = requests.get(self.uri("/containers/json?all=true"))
@@ -36,7 +36,7 @@ class ContainerTestCase(APITestCase):
self.assertId(r.content)
def test_delete(self):
- r = requests.delete(self.uri(self.resolve_container("/containers/{}")))
+ r = requests.delete(self.uri(self.resolve_container("/containers/{}?force=true")))
self.assertEqual(r.status_code, 204, r.text)
def test_stop(self):
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 9d0049910..70a1d09ed 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -425,6 +425,106 @@ var _ = Describe("Podman checkpoint", func() {
// Remove exported checkpoint
os.Remove(fileName)
})
+ // This test does the same steps which are necessary for migrating
+ // a container from one host to another
+ It("podman checkpoint container with export and different compression algorithms", func() {
+ localRunString := getRunString([]string{"--rm", ALPINE, "top"})
+ session := podmanTest.Podman(localRunString)
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ cid := session.OutputToString()
+ fileName := "/tmp/checkpoint-" + cid + ".tar"
+
+ // Checkpoint with the default algorithm
+ result := podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", fileName})
+ result.WaitWithDefaultTimeout()
+
+ // As the container has been started with '--rm' it will be completely
+ // cleaned up after checkpointing.
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(0))
+
+ // Restore container
+ result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
+ result.WaitWithDefaultTimeout()
+
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
+
+ // Checkpoint with the zstd algorithm
+ result = podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", fileName, "--compress", "zstd"})
+ result.WaitWithDefaultTimeout()
+
+ // As the container has been started with '--rm' it will be completely
+ // cleaned up after checkpointing.
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(0))
+
+ // Restore container
+ result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
+ result.WaitWithDefaultTimeout()
+
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
+
+ // Checkpoint with the none algorithm
+ result = podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", fileName, "-c", "none"})
+ result.WaitWithDefaultTimeout()
+
+ // As the container has been started with '--rm' it will be completely
+ // cleaned up after checkpointing.
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(0))
+
+ // Restore container
+ result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
+ result.WaitWithDefaultTimeout()
+
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
+
+ // Checkpoint with the gzip algorithm
+ result = podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", fileName, "-c", "gzip"})
+ result.WaitWithDefaultTimeout()
+
+ // As the container has been started with '--rm' it will be completely
+ // cleaned up after checkpointing.
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(0))
+
+ // Restore container
+ result = podmanTest.Podman([]string{"container", "restore", "-i", fileName})
+ result.WaitWithDefaultTimeout()
+
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
+
+ // Checkpoint with the non-existing algorithm
+ result = podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", fileName, "-c", "non-existing"})
+ result.WaitWithDefaultTimeout()
+
+ Expect(result.ExitCode()).To(Equal(125))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(1))
+
+ result = podmanTest.Podman([]string{"rm", "-fa"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(0))
+
+ // Remove exported checkpoint
+ os.Remove(fileName)
+ })
It("podman checkpoint and restore container with root file-system changes", func() {
// Start the container
@@ -822,4 +922,58 @@ var _ = Describe("Podman checkpoint", func() {
os.Remove(checkpointFileName)
os.Remove(preCheckpointFileName)
})
+
+ It("podman checkpoint and restore container with different port mappings", func() {
+ localRunString := getRunString([]string{"-p", "1234:6379", "--rm", redis})
+ session := podmanTest.Podman(localRunString)
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid := session.OutputToString()
+ fileName := "/tmp/checkpoint-" + cid + ".tar.gz"
+
+ // Open a network connection to the redis server via initial port mapping
+ conn, err := net.Dial("tcp", "localhost:1234")
+ if err != nil {
+ os.Exit(1)
+ }
+ conn.Close()
+
+ // Checkpoint the container
+ result := podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", fileName})
+ result.WaitWithDefaultTimeout()
+
+ // As the container has been started with '--rm' it will be completely
+ // cleaned up after checkpointing.
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(0))
+
+ // Restore container with different port mapping
+ result = podmanTest.Podman([]string{"container", "restore", "-p", "1235:6379", "-i", fileName})
+ result.WaitWithDefaultTimeout()
+
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
+
+ // Open a network connection to the redis server via initial port mapping
+ // This should fail
+ conn, err = net.Dial("tcp", "localhost:1234")
+ Expect(err.Error()).To(ContainSubstring("connection refused"))
+ // Open a network connection to the redis server via new port mapping
+ conn, err = net.Dial("tcp", "localhost:1235")
+ if err != nil {
+ os.Exit(1)
+ }
+ conn.Close()
+
+ result = podmanTest.Podman([]string{"rm", "-fa"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(0))
+
+ // Remove exported checkpoint
+ os.Remove(fileName)
+ })
})
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
index 4dbbe9dd8..cc7c4d996 100644
--- a/test/e2e/events_test.go
+++ b/test/e2e/events_test.go
@@ -8,6 +8,7 @@ import (
"sync"
"time"
+ "github.com/containers/podman/v3/libpod/events"
. "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
@@ -134,12 +135,10 @@ var _ = Describe("Podman events", func() {
jsonArr := test.OutputToStringArray()
Expect(test.OutputToStringArray()).ShouldNot(BeEmpty())
- eventsMap := make(map[string]string)
- err := json.Unmarshal([]byte(jsonArr[0]), &eventsMap)
+ event := events.Event{}
+ err := json.Unmarshal([]byte(jsonArr[0]), &event)
Expect(err).ToNot(HaveOccurred())
- Expect(eventsMap).To(HaveKey("Status"))
-
test = podmanTest.Podman([]string{"events", "--stream=false", "--format", "{{json.}}"})
test.WaitWithDefaultTimeout()
Expect(test).To(Exit(0))
@@ -147,11 +146,9 @@ var _ = Describe("Podman events", func() {
jsonArr = test.OutputToStringArray()
Expect(test.OutputToStringArray()).ShouldNot(BeEmpty())
- eventsMap = make(map[string]string)
- err = json.Unmarshal([]byte(jsonArr[0]), &eventsMap)
+ event = events.Event{}
+ err = json.Unmarshal([]byte(jsonArr[0]), &event)
Expect(err).ToNot(HaveOccurred())
-
- Expect(eventsMap).To(HaveKey("Status"))
})
It("podman events --until future", func() {
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
index 75d778f10..e03d6899e 100644
--- a/test/e2e/generate_systemd_test.go
+++ b/test/e2e/generate_systemd_test.go
@@ -215,7 +215,6 @@ var _ = Describe("Podman generate systemd", func() {
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring("# container-foo.service"))
Expect(session.OutputToString()).To(ContainSubstring(" --replace "))
- Expect(session.OutputToString()).To(ContainSubstring(" stop --ignore --cidfile %t/container-foo.ctr-id -t 42"))
if !IsRemote() {
// The podman commands in the unit should contain the root flags if generate systemd --new is used
Expect(session.OutputToString()).To(ContainSubstring(" --runroot"))
@@ -234,7 +233,6 @@ var _ = Describe("Podman generate systemd", func() {
// Grepping the output (in addition to unit tests)
Expect(session.OutputToString()).To(ContainSubstring("# container-foo.service"))
Expect(session.OutputToString()).To(ContainSubstring(" --replace "))
- Expect(session.OutputToString()).To(ContainSubstring(" stop --ignore --cidfile %t/container-foo.ctr-id -t 42"))
})
It("podman generate systemd --new without explicit detaching param", func() {
@@ -247,7 +245,7 @@ var _ = Describe("Podman generate systemd", func() {
Expect(session.ExitCode()).To(Equal(0))
// Grepping the output (in addition to unit tests)
- Expect(session.OutputToString()).To(ContainSubstring("--cgroups=no-conmon -d"))
+ Expect(session.OutputToString()).To(ContainSubstring(" -d "))
})
It("podman generate systemd --new with explicit detaching param in middle", func() {
diff --git a/test/system/090-events.bats b/test/system/090-events.bats
index 52936d7a0..d889bd7f9 100644
--- a/test/system/090-events.bats
+++ b/test/system/090-events.bats
@@ -6,7 +6,6 @@
load helpers
@test "events with a filter by label" {
- skip_if_remote "FIXME: -remote does not include labels in event output"
cname=test-$(random_string 30 | tr A-Z a-z)
labelname=$(random_string 10)
labelvalue=$(random_string 15)
diff --git a/test/system/255-auto-update.bats b/test/system/255-auto-update.bats
new file mode 100644
index 000000000..59f53f775
--- /dev/null
+++ b/test/system/255-auto-update.bats
@@ -0,0 +1,279 @@
+#!/usr/bin/env bats -*- bats -*-
+#
+# Tests for automatically update images for containerized services
+#
+
+load helpers
+
+UNIT_DIR="/usr/lib/systemd/system"
+SNAME_FILE=$BATS_TMPDIR/services
+
+function setup() {
+ skip_if_remote "systemd tests are meaningless over remote"
+ skip_if_rootless
+
+ basic_setup
+}
+
+function teardown() {
+ while read line; do
+ if [[ "$line" =~ "podman-auto-update" ]]; then
+ echo "Stop timer: $line.timer"
+ systemctl stop $line.timer
+ systemctl disable $line.timer
+ else
+ systemctl stop $line
+ fi
+ rm -f $UNIT_DIR/$line.{service,timer}
+ done < $SNAME_FILE
+
+ rm -f $SNAME_FILE
+ run_podman ? rmi quay.io/libpod/alpine:latest
+ run_podman ? rmi quay.io/libpod/alpine_nginx:latest
+ run_podman ? rmi quay.io/libpod/localtest:latest
+ basic_teardown
+}
+
+# This functions is used for handle the basic step in auto-update related
+# tests. Including following steps:
+# 1. Generate a random container name and echo it to output.
+# 2. Tag the fake image before test
+# 3. Start a container with io.containers.autoupdate
+# 4. Generate the service file from the container
+# 5. Remove the origin container
+# 6. Start the container from service
+function generate_service() {
+ target_img_basename=$1
+ autoupdate=$2
+
+ # Please keep variable name for cname and ori_image. The
+ # scripts will use them directly in following tests.
+ cname=c_$(random_string)
+ target_img="quay.io/libpod/$target_img_basename:latest"
+ run_podman tag $IMAGE $target_img
+ if [[ -n "$autoupdate" ]]; then
+ label="--label io.containers.autoupdate=$autoupdate"
+ else
+ label=""
+ fi
+ run_podman run -d --name $cname $label $target_img top -d 120
+
+ run_podman generate systemd --new $cname
+ echo "$output" > "$UNIT_DIR/container-$cname.service"
+ echo "container-$cname" >> $SNAME_FILE
+ run_podman rm -f $cname
+
+ systemctl daemon-reload
+ systemctl start container-$cname
+ systemctl status container-$cname
+
+ run_podman inspect --format "{{.Image}}" $cname
+ ori_image=$output
+}
+
+function _wait_service_ready() {
+ local sname=$1
+
+ local timeout=6
+ while [[ $timeout -gt 1 ]]; do
+ run systemctl is-active $sname
+ if [[ $output == "active" ]]; then
+ return
+ fi
+ sleep 1
+ let timeout=$timeout-1
+ done
+
+ # Print serivce status as debug information before failed the case
+ systemctl status $sname
+ die "Timed out waiting for $sname to start"
+}
+
+function _confirm_update() {
+ local sname=$1
+
+ local timeout=6
+ last_log=""
+ while [[ $timeout -gt 1 ]]; do
+ run journalctl -u $sname -n 10
+ if [[ "$output" == "$last_log" ]]; then
+ return
+ fi
+ last_log=$output
+ sleep 1
+ let timeout=$timeout-1
+ done
+
+ die "Timed out waiting for $sname to update"
+}
+
+# This test can fail in dev. environment because of SELinux.
+# quick fix: chcon -t container_runtime_exec_t ./bin/podman
+@test "podman auto-update - label io.containers.autoupdate=image" {
+ run_podman images
+ generate_service alpine image
+
+ _wait_service_ready container-$cname.service
+ run_podman ps -a
+ run_podman auto-update
+ is "$output" "Trying to pull.*" "Image is updated."
+ run_podman ps -a
+ _confirm_update container-$cname.service
+ run_podman inspect --format "{{.Image}}" $cname
+ [[ "$output" != "$ori_image" ]]
+}
+
+@test "podman auto-update - label io.containers.autoupdate=disabled" {
+ generate_service alpine disabled
+
+ _wait_service_ready container-$cname.service
+ run_podman ps -a
+ run_podman auto-update
+ is "$output" "" "Image is not updated with disabled."
+ run_podman ps -a
+ _confirm_update container-$cname.service
+ run_podman inspect --format "{{.Image}}" $cname
+ is "$output" "$ori_image" "Image hash should not changed."
+}
+
+@test "podman auto-update - label io.containers.autoupdate=fakevalue" {
+ fakevalue=$(random_string)
+ generate_service alpine $fakevalue
+
+ _wait_service_ready container-$cname.service
+ run_podman ps -a
+ run_podman ? auto-update
+ is "$output" ".*invalid auto-update policy.*" "invalid policy setup"
+ run_podman ps -a
+ _confirm_update container-$cname.service
+ run_podman inspect --format "{{.Image}}" $cname
+ is "$output" "$ori_image" "Image hash should not changed."
+}
+
+@test "podman auto-update - label io.containers.autoupdate=local" {
+ generate_service localtest local
+ podman commit --change CMD=/bin/bash $cname quay.io/libpod/localtest:latest
+
+ _wait_service_ready container-$cname.service
+ run_podman ps -a
+ run_podman auto-update
+ run_podman ps -a
+ _confirm_update container-$cname.service
+ run_podman inspect --format "{{.Image}}" $cname
+ [[ "$output" != "$ori_image" ]]
+}
+
+@test "podman auto-update with multiple services" {
+ fakevalue=$(random_string)
+ run_podman inspect --format "{{.Id}}" $IMAGE
+ img_id="$output"
+ cnames=()
+ local -A expect_update
+ local -A will_update=([image]=1 [registry]=1 [local]=1)
+
+ for auto_update in image registry "" disabled "''" $fakevalue local
+ do
+ img_base="alpine"
+ if [[ $auto_update == "registry" ]]; then
+ img_base="alpine_nginx"
+ elif [[ $auto_update == "local" ]]; then
+ img_base="localtest"
+ fi
+ generate_service $img_base $auto_update
+ cnames+=($cname)
+ if [[ $auto_update == "local" ]]; then
+ local_cname=$cname
+ fi
+ if [[ -n "$auto_update" && -n "${will_update[$auto_update]}" ]]; then
+ expect_update[$cname]=1
+ fi
+ done
+
+ # Only check the last service is started. Previous services should already actived.
+ _wait_service_ready container-$cname.service
+ run_podman commit --change CMD=/bin/bash $local_cname quay.io/libpod/localtest:latest
+ run_podman ? auto-update
+ update_log=$output
+ for cname in "${cnames[@]}"; do
+ _confirm_update container-$cname.service
+ done
+ count=0
+ while read line; do
+ if [[ "$line" =~ "Trying to pull" ]]; then
+ ((count+=1))
+ fi
+ done <<< "$update_log"
+ is "$update_log" ".*invalid auto-update policy.*" "invalid policy setup"
+ is "$update_log" ".*1 error occurred.*" "invalid policy setup"
+ is "$count" "2" "There are two images being updated from registry."
+
+ for cname in "${!expect_update[@]}"; do
+
+ is "$update_log" ".*$cname.*" "container with auto-update policy image updated"
+ done
+
+ for cname in "${cnames[@]}"; do
+ run_podman inspect --format "{{.Image}}" $cname
+ if [[ -n "${expect_update[$cname]}" ]]; then
+ [[ "$output" != "$img_id" ]]
+ else
+ is "$output" "$img_id" "Image should not be changed."
+ fi
+ done
+}
+
+@test "podman auto-update using systemd" {
+ generate_service alpine image
+
+ cat >$UNIT_DIR/podman-auto-update-$cname.timer <<EOF
+[Unit]
+Description=Podman auto-update testing timer
+
+[Timer]
+OnCalendar=*-*-* *:*:0/2
+Persistent=true
+
+[Install]
+WantedBy=timers.target
+EOF
+ cat >$UNIT_DIR/podman-auto-update-$cname.service <<EOF
+[Unit]
+Description=Podman auto-update testing service
+Documentation=man:podman-auto-update(1)
+Wants=network.target
+After=network-online.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/podman auto-update
+
+[Install]
+WantedBy=multi-user.target default.target
+EOF
+
+ echo "podman-auto-update-$cname" >> $SNAME_FILE
+ systemctl enable --now podman-auto-update-$cname.timer
+ systemctl list-timers --all
+
+ count=0
+ failed_start=1
+ while [ $count -lt 120 ]; do
+ run journalctl -n 15 -u podman-auto-update-$cname.service
+ if [[ "$output" =~ "Finished Podman auto-update testing service" ]]; then
+ failed_start=0
+ break
+ fi
+ ((count+=1))
+ sleep 1
+ done
+ echo $output
+
+ _confirm_update container-$cname.service
+ run_podman inspect --format "{{.Image}}" $cname
+ if [[ $failed_start == 1 ]]; then
+ die "Failed to get podman auto-update service finished"
+ fi
+ [[ "$output" != "$ori_image" ]]
+}
+
+# vim: filetype=sh
diff --git a/test/system/450-interactive.bats b/test/system/450-interactive.bats
index a9bf52ee8..a2db39492 100644
--- a/test/system/450-interactive.bats
+++ b/test/system/450-interactive.bats
@@ -56,8 +56,7 @@ function teardown() {
stty rows $rows cols $cols <$PODMAN_TEST_PTY
# ...and make sure stty under podman reads that.
- # FIXME: 'sleep 1' is needed for podman-remote; without it, there's
- run_podman run -it --name mystty $IMAGE sh -c 'sleep 1;stty size' <$PODMAN_TEST_PTY
+ run_podman run -it --name mystty $IMAGE stty size <$PODMAN_TEST_PTY
is "$output" "$rows $cols" "stty under podman reads the correct dimensions"
}
diff --git a/troubleshooting.md b/troubleshooting.md
index e320f20e7..ab9fffeb3 100644
--- a/troubleshooting.md
+++ b/troubleshooting.md
@@ -697,3 +697,32 @@ limits.
This can happen when running a container from an image for another architecture than the one you are running on.
For example, if a remote repository only has, and thus send you, a `linux/arm64` _OS/ARCH_ but you run on `linux/amd64` (as happened in https://github.com/openMF/community-app/issues/3323 due to https://github.com/timbru31/docker-ruby-node/issues/564).
+
+### 27) `Error: failed to create sshClient: Connection to bastion host (ssh://user@host:22/run/user/.../podman/podman.sock) failed.: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain`
+
+In some situations where the client is not on the same machine as where the podman daemon is running the client key could be using a cipher not supported by the host. This indicates an issue with one's SSH config. Until remedied using podman over ssh
+with a pre-shared key will be impossible.
+
+#### Symptom
+
+The accepted ciphers per `/etc/crypto-policies/back-ends/openssh.config` are not one that was used to create the public/private key pair that was transferred over to the host for ssh authentication.
+
+You can confirm this is the case by attempting to connect to the host via `podman-remote info` from the client and simultaneously on the host running `journalctl -f` and watching for the error `userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]`.
+
+#### Solution
+
+Create a new key using a supported algorithm e.g. ecdsa:
+
+`ssh-keygen -t ecdsa -f ~/.ssh/podman`
+
+Then copy the new id over:
+
+`ssh-copy-id -i ~/.ssh/podman.pub user@host`
+
+And then re-add the connection (removing the old one if necessary):
+
+`podman-remote system connection add myuser --identity ~/.ssh/podman ssh://user@host/run/user/1000/podman/podman.sock`
+
+And now this should work:
+
+`podman-remote info`
diff --git a/version/version.go b/version/version.go
index 1cbd9e309..71292305d 100644
--- a/version/version.go
+++ b/version/version.go
@@ -27,7 +27,7 @@ const (
// NOTE: remember to bump the version at the top
// of the top-level README.md file when this is
// bumped.
-var Version = semver.MustParse("3.2.0-dev")
+var Version = semver.MustParse("3.3.0-dev")
// See https://docs.docker.com/engine/api/v1.40/
// libpod compat handlers are expected to honor docker API versions