Commit graph

2513 commits

Author SHA1 Message Date
OpenShift Merge Robot db52828621
Merge pull request #8946 from JAORMX/sec-errors
Expose security attribute errors with their own messages
2021-01-12 13:46:29 -05:00
OpenShift Merge Robot db5e7ec4c4
Merge pull request #8947 from Luap99/cleanup-code
Fix problems reported by staticcheck
2021-01-12 13:15:35 -05:00
Matthew Heon befd40b57d Exorcise Driver code from libpod/define
The libpod/define code should not import any large dependencies,
as it is intended to be structures and definitions only. It
included the libpod/driver package for information on the storage
driver, though, which brought in all of c/storage. Split the
driver package so that define has the struct, and thus does not
need to import Driver. And simplify the driver code while we're
at it.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-01-12 11:48:53 -05:00
Paul Holzinger 8452b768ec Fix problems reported by staticcheck
`staticcheck` is a golang code analysis tool. https://staticcheck.io/

This commit fixes a lot of problems found in our code. Common problems are:
- unnecessary use of fmt.Sprintf
- duplicated imports with different names
- unnecessary check that a key exists before a delete call

There are still a lot of reported problems in the test files but I have
not looked at those.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-12 16:11:09 +01:00
Juan Antonio Osorio Robles 020abbfeab Expose security attribute errors with their own messages
This creates error objects for runtime errors that might come from the
runtime. Thus, indicating to users that the place to debug should be in
the security attributes of the container.

When creating a container with a SELinux label that doesn't exist, we
get a fairly cryptic error message:

```
$ podman run --security-opt label=type:my_container.process -it fedora bash
Error: OCI runtime error: write file `/proc/thread-self/attr/exec`: Invalid argument
```

This instead handles any errors coming from LSM's `/proc` API and
enhances the error message with a relevant indicator that it's related
to the container's security attributes.

A sample run looks as follows:

```
$ bin/podman run --security-opt label=type:my_container.process -it fedora bash
Error: `/proc/thread-self/attr/exec`: OCI runtime error: unable to assign security attribute
```

With `debug` log level enabled it would be:

```
Error: write file `/proc/thread-self/attr/exec`: Invalid argument: OCI runtime error: unable to assign security attribute
```

Note that these errors wrap ErrOCIRuntime, so it's still possible to to
compare these errors with `errors.Is/errors.As`.

One advantage of this approach is that we could start handling these
errors in a more efficient manner in the future.

e.g. If a SELinux label doesn't exist (yet), we could retry until it
becomes available.

Signed-off-by: Juan Antonio Osorio Robles <jaosorior@redhat.com>
2021-01-12 16:10:17 +02:00
OpenShift Merge Robot 5575c7be20
Merge pull request #8819 from chen-zhuohan/add-pre-checkpoint
Add pre-checkpoint and restore with previous
2021-01-12 07:57:05 -05:00
OpenShift Merge Robot 1955eee89f
Merge pull request #8933 from giuseppe/use-O_PATH-for-unix-sock
oci: use /proc/self/fd/FD to open unix socket
2021-01-12 07:26:37 -05:00
Giuseppe Scrivano fdbc278868
oci: use /proc/self/fd/FD to open unix socket
instead of opening directly the UNIX socket path, grab a reference to
it through a O_PATH file descriptor and use the fixed size string
"/proc/self/fd/%d" to open the UNIX socket.  In this way it won't hit
the 108 chars length limit.

Closes: https://github.com/containers/podman/issues/8798

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-12 10:38:32 +01:00
Giuseppe Scrivano ae9dab9445
oci: keep LC_ env variables to conmon
it is necessary for conmon to deal with the correct locale, otherwise
it uses C as a fallback.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1893567
Requires: https://github.com/containers/conmon/pull/215

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-11 13:48:04 +01:00
unknown 2aa381f2d0 add pre checkpoint
Signed-off-by: Zhuohan Chen <chen_zhuohan@163.com>
2021-01-10 21:38:28 +08:00
OpenShift Merge Robot 49db79e735
Merge pull request #8781 from rst0git/cr-volumes
Add support for checkpoint/restore of containers with volumes
2021-01-08 10:41:05 -05:00
OpenShift Merge Robot 6c132b78f1
Merge pull request #8771 from rhatdan/run
Switch references of /var/run -> /run
2021-01-07 15:06:17 -05:00
OpenShift Merge Robot 3cf41c4a73
Merge pull request #8821 from rhatdan/caps
Containers should not get inheritable caps by default
2021-01-07 09:44:37 -05:00
OpenShift Merge Robot 74af9254b9
Merge pull request #8816 from giuseppe/automatically-split-userns-mappings
rootless: automatically split userns ranges
2021-01-07 09:35:01 -05:00
Daniel J Walsh db71759b1a
Handle podman exec capabilities correctly
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-07 05:53:50 -05:00
Daniel J Walsh d9ebbbfe5b
Switch references of /var/run -> /run
Systemd is now complaining or mentioning /var/run as a legacy directory.
It has been many years where /var/run is a symlink to /run on all
most distributions, make the change to the default.

Partial fix for https://github.com/containers/podman/issues/8369

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-07 05:37:24 -05:00
Giuseppe Scrivano ecedda63a6
rootless: automatically split userns ranges
writing to the id map fails when an extent overlaps multiple mappings
in the parent user namespace:

$ cat /proc/self/uid_map
         0       1000          1
         1     100000      65536
$ unshare -U sleep 100 &
[1] 1029703
$ printf "0 0 100\n" | tee /proc/$!/uid_map
0 0 100
tee: /proc/1029703/uid_map: Operation not permitted

This limitation is particularly annoying when working with rootless
containers as each container runs in the rootless user namespace, so a
command like:

$ podman run --uidmap 0:0:2 --rm fedora echo hi
Error: writing file `/proc/664087/gid_map`: Operation not permitted: OCI permission denied

would fail since the specified mapping overlaps the first
mapping (where the user id is mapped to root) and the second extent
with the additional IDs available.

Detect such cases and automatically split the specified mapping with
the equivalent of:

$ podman run --uidmap 0:0:1 --uidmap 1:1:1 --rm fedora echo hi
hi

A fix has already been proposed for the kernel[1], but even if it
accepted it will take time until it is available in a released kernel,
so fix it also in pkg/rootless.

[1] https://lkml.kernel.org/lkml/20201203150252.1229077-1-gscrivan@redhat.com/

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-07 09:42:27 +01:00
Radostin Stoyanov 288ccc4c84 Include named volumes in container migration
When migrating a container with associated volumes, the content of
these volumes should be made available on the destination machine.

This patch enables container checkpoint/restore with named volumes
by including the content of volumes in checkpoint file. On restore,
volumes associated with container are created and their content is
restored.

The --ignore-volumes option is introduced to disable this feature.

Example:

 # podman container checkpoint --export checkpoint.tar.gz <container>

The content of all volumes associated with the container are included
in `checkpoint.tar.gz`

 # podman container checkpoint --export checkpoint.tar.gz --ignore-volumes <container>

The content of volumes is not included in `checkpoint.tar.gz`. This is
useful, for example, when the checkpoint/restore is performed on the
same machine.

 # podman container restore --import checkpoint.tar.gz

The associated volumes will be created and their content will be
restored. Podman will exit with an error if volumes with the same
name already exist on the system or the content of volumes is not
included in checkpoint.tar.gz

 # podman container restore --ignore-volumes --import checkpoint.tar.gz

Volumes associated with container must already exist. Podman will not
create them or restore their content.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-01-07 07:51:19 +00:00
Radostin Stoyanov 17f50fb4bf Use Options as exportCheckpoint() argument
Instead of individual values from ContainerCheckpointOptions,
provide the options object.

This is a preparation for the next patch where one more value
of the options object is required in exportCheckpoint().

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-01-07 07:48:41 +00:00
Paul Holzinger b7f699c199 Fix podman logs read partial log lines
If a partial log line has the length 1 it was ignored by podman logs.

Fixes #8879

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-07 00:04:38 +01:00
OpenShift Merge Robot bb82c37b73
Merge pull request #8805 from giuseppe/single-user-mapped-root
libpod: handle single user mapped as root
2021-01-06 15:41:36 -05:00
OpenShift Merge Robot 8e4613ab0a
Merge pull request #8892 from mheon/fix_8886
Ensure that user-specified HOSTNAME is honored
2021-01-06 15:26:55 -05:00
Matthew Heon 8f844a66d5 Ensure that user-specified HOSTNAME is honored
When adding the HOSTNAME environment variable, only do so if it
is not already present in the spec. If it is already present, it
was likely added by the user, and we should honor their requested
value.

Fixes #8886

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-01-06 09:46:21 -05:00
OpenShift Merge Robot ffe2b1e95a
Merge pull request #8685 from mheon/ignore_containersconf_sysctls_shared_net
Ignore containers.conf sysctls when sharing namespaces
2021-01-05 17:08:31 -05:00
OpenShift Merge Robot b84b7c89bb
Merge pull request #8831 from bblenard/issue-8658-system-prune-reclaimed-space
Rework pruning to report reclaimed space
2021-01-05 11:35:18 -05:00
OpenShift Merge Robot 1b9366d650
Merge pull request #8873 from baude/issue8864
close journald when reading
2021-01-05 04:34:24 -05:00
OpenShift Merge Robot 618c35570d
Merge pull request #8878 from mheon/no_edit_config
Ensure we do not edit container config in Exec
2021-01-04 21:11:27 -05:00
OpenShift Merge Robot ced7c0ab7f
Merge pull request #8875 from rhatdan/image
Allow image errors to bubble up from lower level functions.
2021-01-04 17:30:22 -05:00
Matthew Heon 864592c746 Add default sysctls for pod infra containers
Ensure that infra containers for pods will grab default sysctls
from containers.conf, to match how other containers are created.
This mostly affects the other containers in the pod, which will
inherit those sysctls when they join the pod's namespaces.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-01-04 15:29:18 -05:00
Matthew Heon 960607a4cd Ensure we do not edit container config in Exec
The existing code grabs the base container's process, and then
modifies it for use with the exec session. This could cause
errors in `podman inspect` or similar on the container, as the
definition of its OCI spec has been changed by the exec session.
The change never propagates to the DB, so it's limited to a
single process, but we should still avoid it when possible - so
deep-copy it before use.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-01-04 14:36:41 -05:00
baude 002d0d6ee6 close journald when reading
when reading from journald, we need to close the journal handler for
events and logging.

Fixes: #8864

Signed-off-by: baude <bbaude@redhat.com>
2021-01-04 13:27:38 -06:00
Daniel J Walsh d0093026a2
Allow image errors to bubble up from lower level functions.
Currently we ignore ErrMultipleImages being returned from findImageInRepoTags.

Fixes: https://github.com/containers/podman/issues/8868

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-04 10:51:54 -05:00
Giuseppe Scrivano 898f57c4c1
systemd: make rundir always accessible
so that the PIDFile can be accessed also without being in the rootless
user namespace.

Closes: https://github.com/containers/podman/issues/8506

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-01-04 14:19:58 +01:00
OpenShift Merge Robot 23f25b8261
Merge pull request #8823 from giuseppe/exec-honor-privileged
exec: honor --privileged
2021-01-04 10:53:44 +01:00
Baron Lenardson b90f7f9095 Rework pruning to report reclaimed space
This change adds code to report the reclaimed space after a prune.
Reclaimed space from volumes, images, and containers is recorded
during the prune call in a PruneReport struct. These structs are
collected into a slice during a system prune and processed afterwards
to calculate the total reclaimed space.

Closes #8658

Signed-off-by: Baron Lenardson <lenardson.baron@gmail.com>
2020-12-30 19:57:35 -06:00
OpenShift Merge Robot c6c9b45985
Merge pull request #8852 from afbjorklund/slirp_sandbox-no_pivot_root
The slirp4netns sandbox requires pivot_root
2020-12-30 16:03:28 +01:00
OpenShift Merge Robot a84383297c
Merge pull request #8853 from jubalh/gentoo
Add support for Gentoo file to package query
2020-12-30 15:57:55 +01:00
Michael Vetter 904dec2164 Add support for Gentoo file to package query
On Gentoo systems where `app-portage/gentoolkit` is installed the binary
`equery` is used to query for information on which package a file
belongs to.

Signed-off-by: Michael Vetter <jubalh@iodoru.org>
2020-12-29 20:33:27 +01:00
Anders F Björklund 25b7198441 The slirp4netns sandbox requires pivot_root
Disable the sandbox, when running on rootfs

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2020-12-29 18:03:49 +01:00
Giuseppe Scrivano 2a39a6195a
exec: honor --privileged
write the capabilities to the configuration passed to the OCI
runtime.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-12-24 22:11:14 +01:00
Giuseppe Scrivano 2a97639263
libpod: change function to accept ExecOptions
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-12-24 22:01:38 +01:00
Baron Lenardson 76afb50f3a Consolidate filter logic to pkg subdirectory
Per the conversation on pull/8724 I am consolidating filter logic
and helper functions under the pkg/domain/filters dir.

Signed-off-by: Baron Lenardson <lenardson.baron@gmail.com>
2020-12-24 20:27:41 +00:00
Giuseppe Scrivano 64571ea0a4
libpod: handle single user mapped as root
if a single user is mapped in the user namespace, handle it as root.

It is needed for running unprivileged containers with a single user
available without being forced to run with euid and egid set to 0.

Needs: https://github.com/containers/storage/pull/794

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-12-24 13:39:15 +01:00
OpenShift Merge Robot 231c528a4d
Merge pull request #8822 from baude/issue8733
re-open container log files
2020-12-24 02:40:04 +01:00
OpenShift Merge Robot 9ac5ed1e08
Merge pull request #8806 from rhatdan/keyring
Pass down EnableKeyring from containers.conf to conmon
2020-12-23 21:41:25 +01:00
baude 0301e4d7bc re-open container log files
when following container log files, if the file gets rotated due to
something like size limit, re-open it and keep following.

Fixes: #8733

Signed-off-by: baude <bbaude@redhat.com>
2020-12-23 14:04:32 -06:00
OpenShift Merge Robot bbc0deb8e8
Merge pull request #8609 from rhatdan/image
Prefer read/write images over read/only images
2020-12-23 20:36:28 +01:00
OpenShift Merge Robot 54b82a175f
Merge pull request #8787 from jsoref/spelling
Spelling
2020-12-23 17:38:43 +01:00
OpenShift Merge Robot 0778c114d3
Merge pull request #8793 from zhangguanzhang/vol-op
Fix missing options in volume's display while setting uid and gid
2020-12-23 16:40:22 +01:00
Daniel J Walsh 767e1ac17f
Merge pull request #8804 from baude/issue8512
add pod filter for ps
2020-12-23 04:42:30 -05:00
zhangguanzhang 28138dafcc Fix missing options in volumes display while setting uid and gid
```
$ podman volume create testvol --opt o=uid=1001,gid=1001
$ ./bin/podman volume create testvol2 --opt o=uid=1001,gid=1001
$ podman volume inspect testvol
        "Options": {},
$ podman volume inspect testvol2
        "Options": {
            "GID": "1001",
            "UID": "1001",
            "o": "uid=1001,gid=1001"
        },
```

Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-12-23 09:13:20 +08:00
Josh Soref 4fa1fce930 Spelling
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-12-22 13:34:31 -05:00
Daniel J Walsh b0a738ce79
Pass down EnableKeyring from containers.conf to conmon
We have a new field in containers.conf that tells whether
or not we want to generate a new keyring in a container.

This field was being ignored.  It now will be followed and
passed down to conmon.

Fixes: https://github.com/containers/podman/issues/8384

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-22 13:08:41 -05:00
OpenShift Merge Robot 07663f74c4
Merge pull request #8724 from bblenard/support-volume-filters-in-system-prune
Add volume filters to system prune
2020-12-22 11:02:19 -05:00
Daniel J Walsh e577ddf3bd
Prefer read/write images over read/only images
With additional stores there is a risk that you could have
multiple images with the same name.  IE An older image in a
read/only store versus a newer version in the read/write store.

This patch will ignore multiple images with the same name iff
one is read/write and all of the others are read/only.

Fixes: https://github.com/containers/podman/issues/8176

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-22 10:41:39 -05:00
baude c50c75419b add pod filter for ps
adds the ability to filter containers based on the filter "pod".  the
value can be a pod name or its full or partial id.

Fixes: #8512

Signed-off-by: baude <bbaude@redhat.com>
2020-12-22 09:40:39 -06:00
Daniel J Walsh 04b43ccf64
Add Security information to podman info
When debugging issues, it would be helpful to know the
security settings of the system running into the problem.
Adding security info to `podman info` is also useful to users.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-22 08:13:14 -05:00
Baron Lenardson 5923656f32 Add volume filters to system prune
This change was missed in pull/8689. Now that volume pruneing supports
filters system pruneing can pass its filters down to the volume
pruneing. Additionally this change adds tests for the following components

* podman system prune subcommand with `--volumes` & `--filter` options
* apiv2 api tests for `/system/` and `/libpod/system` endpoints

Relates to #8453, #8672

Signed-off-by: Baron Lenardson <lenardson.baron@gmail.com>
2020-12-21 10:55:39 -06:00
OpenShift Merge Robot c38ae47a1a
Merge pull request #8750 from rhatdan/reset
Don't accidently remove XDG_RUNTIME_DIR when reseting storage
2020-12-17 12:05:33 +00:00
OpenShift Merge Robot 915ae6d9bf
Merge pull request #8756 from Luap99/fix-8748
Always add the default gateway to the cni config file
2020-12-16 22:30:45 +00:00
xatier b6f5163460
Add support for pacman package version query
- refactor package query logic to be package manager agnostic.

- `pacman -Qo` is the equivalent to `rpm -qf` [1].

[1] https://wiki.archlinux.org/index.php/Pacman/Rosetta#Querying_specific_packages

Signed-off-by: xatier <xatierlike@gmail.com>
2020-12-16 12:38:46 -08:00
Daniel J Walsh 82424aa007
Don't accidently remove XDG_RUNTIME_DIR when reseting storage
In certain cases XDG_RUNTIME_DIR was deleted by accident based on
settings in the storage.conf. This patch verifies that when doing
a storage reset, we don't accidently remove XDG_RUNTIME_DIR.

Fixes: https://github.com/containers/podman/issues/8680

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-16 15:09:37 -05:00
Paul Holzinger edf0e918e3 Always add the default gateway to the cni config file
`podman network create` should always add a gateway to the cni config.
If no gateway is given use the first ip in the subnet. CNI does not require
the gateway field but we need it because of network inspect.

This worked with previous version but was dropped in Commit(e7a72d72fd).

Fixes #8748

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-16 20:59:45 +01:00
Daniel J Walsh e42d920ebf
Add LogSize to container inspect
Other log options are available so we need to add ability to look
up LogSize.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-15 17:22:06 -05:00
Giuseppe Scrivano 08f76bf7a5
libpod, conmon: change log level for rootless
Change the log level when running as rootless when moving conmon to a
different cgroup.

Closes: https://github.com/containers/podman/issues/8721

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-12-15 18:55:51 +01:00
OpenShift Merge Robot 0fd31e2994
Merge pull request #8696 from Luap99/podman-events-until
podman events allow future time for --until
2020-12-14 09:33:42 -05:00
OpenShift Merge Robot 803c078d3b
Merge pull request #8693 from giuseppe/drop-valid-id-in-userns-check
podman: drop checking valid rootless UID
2020-12-14 09:31:20 -05:00
OpenShift Merge Robot e5741b984e
Merge pull request #8689 from bblenard/issue-8672-volume-prune
Add volume prune --filter support
2020-12-14 09:22:30 -05:00
Baron Lenardson a0204ada09 Add volume prune --filter support
This change adds support for the `--filter` / `?filters` arguments on
the `podman volume prune` subcommand.

  * Adds ParseFilterArgumentsIntoFilters helper for consistent
    Filter string slice handling
  * Adds `--filter` support to podman volume prune cli
  * Adds `?filters...` support to podman volume prune api
  * Updates apiv2 / e2e tests

Closes #8672

Signed-off-by: Baron Lenardson <lenardson.baron@gmail.com>
2020-12-12 20:07:04 -06:00
Paul Holzinger 74fcd9fef3 podman events allow future time for --until
The podman events aren't read until the given timestamp if the
timestamp is in the future. It just reads all events until now
and exits afterwards.
This does not make sense and does not match docker. The correct
behavior is to read all events until the given time is reached.

This fixes a bug where the wrong event log file path was used
when running first time with a new storage location.
Fixes #8694

This also fixes the events api endpoint which only exited when
an error occurred. Otherwise it just hung after reading all events.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-11 23:15:09 +01:00
Giuseppe Scrivano f711f5a68d
podman: drop checking valid rootless UID
do not check whether the specified ID is valid in the user namespace.

crun handles this case[1], so the check in Podman prevents to get to
the OCI runtime at all.

$ podman run --user 10:0 --uidmap 0:0:1 --rm -ti fedora:33 sh -c 'id; cat /proc/self/uid_map'
uid=10(10) gid=0(root) groups=0(root),65534(nobody)
        10          0          1

[1] https://github.com/containers/crun/pull/556

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-12-11 15:43:33 +01:00
Paul Holzinger ba545c49a2 podman logs honor stderr correctly
Make the ContainerLogsOptions support two io.Writers,
one for stdout and the other for stderr. The logline already
includes the information to which Writer it has to be written.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-10 22:24:43 +01:00
OpenShift Merge Robot 3cd143fc58
Merge pull request #8611 from vrothberg/short-names
enable short-name aliasing
2020-12-09 10:15:55 -05:00
Matthew Heon 46337b4708 Make podman stats slirp check more robust
Just checking for `rootless.IsRootless()` does not catch all the
cases where slirp4netns is in use - we actually allow it to be
used as root as well. Fortify the conditional here so we don't
fail in the root + slirp case.

Fixes #7883

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-12-08 09:59:00 -05:00
OpenShift Merge Robot 9b3a81a002
Merge pull request #8571 from Luap99/podman-network-reload
Implement pod-network-reload
2020-12-08 06:15:40 -05:00
OpenShift Merge Robot bfbeece27b
Merge pull request #8581 from baude/kubegen
generate kube on multiple containers
2020-12-07 16:16:15 -05:00
OpenShift Merge Robot a5ca03915e
Merge pull request #8632 from mheon/fix_8613
Change name of imageVolumes in container config JSON
2020-12-07 14:04:09 -05:00
Matthew Heon b0286d6b43 Implement pod-network-reload
This adds a new command, 'podman network reload', to reload the
networks of existing containers, forcing recreation of firewall
rules after e.g. `firewall-cmd --reload` wipes them out.

Under the hood, this works by calling CNI to tear down the
existing network, then recreate it using identical settings. We
request that CNI preserve the old IP and MAC address in most
cases (where the container only had 1 IP/MAC), but there will be
some downtime inherent to the teardown/bring-up approach. The
architecture of CNI doesn't really make doing this without
downtime easy (or maybe even possible...).

At present, this only works for root Podman, and only locally.
I don't think there is much of a point to adding remote support
(this is very much a local debugging command), but I think adding
rootless support (to kill/recreate slirp4netns) could be
valuable.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-07 19:26:23 +01:00
baude 749ee2a10e generate kube on multiple containers
add the ability to add multiple containers into a single k8s pod
instead of just one.

also fixed some bugs in the resulting yaml where an empty service
description was being added on error causing the k8s validation to fail.

Signed-off-by: baude <bbaude@redhat.com>
2020-12-07 11:34:39 -06:00
OpenShift Merge Robot 3569e24df8
Merge pull request #8375 from vrothberg/cgroup-path
container cgroup path
2020-12-07 12:30:06 -05:00
Matthew Heon c050fad958 Change name of imageVolumes in container config JSON
Podman pre-1.8 also included a field with this name, which was a
String. Podman 2.2.0 added a new field reusing the name but as a
Struct. This completely broke JSON decode for pre-1.8 containers
in Podman 2.2, resulting in completely broken behavior.

Re-name the JSON field and add a note that the old name should
not be re-used to prevent this problem from re-occurring. This
will still result in containers from 2.2.0 being broken
(specifically, containers with image volumes will have them
disappear) but this is the lesser of two evils.

Fixes #8613

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-12-07 11:50:47 -05:00
Matthew Heon bd2cfe0a93 Do not error on installing duplicate shutdown handler
Installing a duplicate shutdown handler fails, but if a handler
with the same name is already present, we should be set to go.
There's no reason to print a user-facing error about it.

This comes up almost nowhere because Podman never makes more than
one Libpod runtime, but there is one exception (`system reset`)
and the error messages, while harmless, were making people very
confused (we got several bug reports that `system reset` was
nonfunctional).

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-12-07 10:00:36 -05:00
Valentin Rothberg 055248ce98 container cgroup path
Before querying for a container's cgroup path, make sure that the
container is synced.  Also make sure to error out if the container
isn't running.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-12-07 15:16:20 +01:00
Valentin Rothberg 2d30eff068 enable short-name aliasing
Short-name aliasing was introduced with Podman 2.2 as an opt-in preview
by enabling an environment variable.  Now, as we're preparing for the
3.0 release, we can enable short-name aliasing by default.  Opting out
can be done by configuring the `registries.conf` config file.

Please refer to the following blog post for more details:
https://www.redhat.com/sysadmin/container-image-short-names

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-12-05 12:42:32 +01:00
OpenShift Merge Robot 0c2a43b99d
Merge pull request #8489 from ashley-cui/commonslirp
Add ability to set system wide options for slirp4netns
2020-12-05 05:41:52 -05:00
OpenShift Merge Robot b6536d20ed
Merge pull request #8494 from mlegenovic/master
More docker compat API fixes
2020-12-04 15:48:20 -05:00
Ashley Cui d6d3af9e8e Add ability to set system wide options for slirp4netns
Wire in containers.conf options for slirp

Signed-off-by: Ashley Cui <acui@redhat.com>
2020-12-04 13:37:22 -05:00
OpenShift Merge Robot 0f496e4b81
Merge pull request #8570 from vrothberg/run-950
rewrite container copy
2020-12-04 13:33:36 -05:00
OpenShift Merge Robot f01630acf3
Merge pull request #8476 from rhatdan/containerenv
Add containerenv information to /run/.containerenv
2020-12-04 11:56:24 -05:00
Milivoje Legenovic 15d36f120c More docker compat API fixes
Fixes wrong VirtualSize, ParentId, Architecture, Author, Os and OsVersion value

Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
2020-12-04 15:58:46 +01:00
Valentin Rothberg ccbca0b4ab rewrite podman-cp
* Add a new `pkg/copy` to centralize all container-copy related code.

* The new code is based on Buildah's `copier` package.

* The compat `/archive` endpoints use the new `copy` package.

* Update docs and an several new tests.

* Includes many fixes, most notably, the look-up of volumes and mounts.

Breaking changes:

 * Podman is now expecting that container-destination paths exist.
   Before, Podman created the paths if needed.  Docker does not do
   that and I believe Podman should not either as it's a recipe for
   masking errors.  These errors may be user induced (e.g., a path
   typo), or internal typos (e.g., when the destination may be a
   mistakenly unmounted volume).  Let's keep the magic low for such
   a security sensitive feature.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-12-04 14:39:55 +01:00
Daniel J Walsh d9154e97eb
Add containerenv information to /run/.containerenv
We have been asked to leak some information into the container
to indicate:
* The name and id of the container
* The version of podman used to launch the container
* The image name and ID the container is based on.
* Whether the container engine is running in rootless mode.

Fixes: https://github.com/containers/podman/issues/6192

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-03 13:32:15 -05:00
Daniel J Walsh f00cc25a7c
Drop default log-level from error to warn
Our users are missing certain warning messages that would
make debugging issues with Podman easier.

For example if you do a podman build with a Containerfile
that contains the SHELL directive, the Derective is silently
ignored.

If you run with the log-level warn you get a warning message explainging
what happened.

$ podman build --no-cache -f /tmp/Containerfile1 /tmp/
STEP 1: FROM ubi8
STEP 2: SHELL ["/bin/bash", "-c"]
STEP 3: COMMIT
--> 7a207be102a
7a207be102aa8993eceb32802e6ceb9d2603ceed9dee0fee341df63e6300882e

$ podman --log-level=warn build --no-cache -f /tmp/Containerfile1 /tmp/
STEP 1: FROM ubi8
STEP 2: SHELL ["/bin/bash", "-c"]
STEP 3: COMMIT
WARN[0000] SHELL is not supported for OCI image format, [/bin/bash -c] will be ignored. Must use `docker` format
--> 7bd96fd25b9
7bd96fd25b9f755d8a045e31187e406cf889dcf3799357ec906e90767613e95f

These messages will no longer be lost, when we default to WARNing level.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-03 06:28:09 -05:00
OpenShift Merge Robot 7984842d7e
Merge pull request #8556 from mheon/fix_8539
Use Libpod tmpdir for pause path
2020-12-02 22:03:19 +01:00
OpenShift Merge Robot e74072e742
Merge pull request #8112 from QiWang19/load-optional-name
Drop name argument from Load API
2020-12-02 21:35:31 +01:00
Matthew Heon ab88632835 Use Libpod tmpdir for pause path
Previously, we always computed pause path from the Rootless
runtime directory. Problem: this does not match the behavior of
Libpod when the directory changes. Libpod will continue to use
the previous directory, cached in the database; Pause pidfiles
will swap to the new path. This is problematic when the directory
needs to exist to write the pidfile, and Libpod is what creates
the directory.

There are two potential solutions - allow the pause pidfile to
move and just make the directory when we want to write it, or use
the cached Libpod paths for a guaranteed location. This patch
does the second, because it seems safer - we will never miss a
previously-existing pidfile because the location is now
consistent.

Fixes #8539

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-12-02 14:18:37 -05:00
Qi Wang f525d8b843 Do not pass name argument to Load API
Not pass the name argument to Load API. Specify in the document the usage of the optional argument is tagging an additional image.
Close #7337

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-12-02 09:25:01 -05:00
Paul Holzinger c31a5c0d9c Add support for network ids
The network ID is not stored. It is just the sha256 hash from
the network name. There is a risk of a potential hash collision.
However it's very unlikely and even if we hit this it will
complain that more than network with this ID exists.

The main benefit is that the compat api can have proper
network ID support. Also this adds the support for
`podman network ls --format "{{.ID}}"` and `--filter id=<ID>`.

It also ensures that we can do network rm <ID> and network
inspect <ID>.

Since we use a hash this commit is backwards compatible even for
already existing networks.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-02 10:27:00 +01:00
OpenShift Merge Robot c585012db3
Merge pull request #8457 from afbjorklund/bridge-mtu
Add podman network create flag for bridge mtu
2020-12-02 01:01:09 +01:00
Anders F Björklund db70e91bde Validate that the bridge option is supported
Thanks Luap99 for the validation suggestion

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2020-12-01 22:33:16 +01:00
Anders F Björklund 7f1be76b5c Add podman network create option for bridge vlan
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2020-12-01 22:33:16 +01:00
Anders F Björklund b1b35707aa Add podman network create option for bridge mtu
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2020-12-01 22:33:03 +01:00
OpenShift Merge Robot 7f084a8ae2
Merge pull request #8357 from mheon/add_volume_interface_package
Add API for communicating with Docker volume plugins
2020-12-01 22:32:08 +01:00
OpenShift Merge Robot b7ff6f0912
Merge pull request #8505 from Luap99/network-labels
podman network label support
2020-12-01 21:43:27 +01:00
OpenShift Merge Robot 8ffb0ae659
Merge pull request #8426 from mheon/fix_infra_cmd_from_config
Do not ignore infra command from config files
2020-12-01 21:05:10 +01:00
Matthew Heon 594ac4a146 Add API for communicating with Docker volume plugins
Docker provides extensibility through a plugin system, of which
several types are available. This provides an initial library API
for communicating with one type of plugins, volume plugins.
Volume plugins allow for an external service to create and manage
a volume on Podman's behalf.

This does not integrate the plugin system into Libpod or Podman
yet; that will come in subsequent pull requests.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-12-01 12:56:55 -05:00
OpenShift Merge Robot 429d9492f8
Merge pull request #8515 from baude/netconnectstate
network connect disconnect on non-running containers
2020-12-01 16:15:19 +01:00
OpenShift Merge Robot e3f0b7db75
Merge pull request #8400 from rhatdan/varlink
Remove varlink support from podman
2020-12-01 15:30:06 +01:00
OpenShift Merge Robot 9ae12f84e8
Merge pull request #8475 from rhatdan/subscriptions
Switch from pkg/secrets to pkg/subscriptions
2020-12-01 14:31:35 +01:00
baude 7d43cc06dc network connect disconnect on non-running containers
a container can connect and disconnet to networks even when not in a
running state.

Signed-off-by: baude <bbaude@redhat.com>
2020-11-30 16:10:01 -06:00
Matthew Heon 72a4891746 Do not ignore infra command from config files
It looks like this was previously removed because the default
hard-coded `/pause` so we would never take into account the image
config. I've removed the default in c/common and re-added support
to check config files.

While we're at it, fix ENTRYPOINT support - we should not be
setting this if we got ENTRYPOINT from the image.

Fixed https://bugzilla.redhat.com/show_bug.cgi?id=1853455

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-11-30 13:28:12 -05:00
OpenShift Merge Robot 8b2c0a4fa3
Merge pull request #8493 from Luap99/net-rm-macvlan
Fix problems with network remove
2020-11-28 20:32:26 +01:00
Paul Holzinger 8494bcb866 podman network label support
Add label support for podman network create. Use the `args`
field in the cni config file to store the podman labels.
Use `podman_labels` as key name and store the labels as
map[string]string.

For reference: https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#args-in-network-config
https://github.com/containernetworking/cni/blob/spec-v0.4.0/SPEC.md#network-configuration

Example snippet:

```
...
"args": {
	"podman_labels": {
		"key1":"value1",
		"key2":"value2"
	}
}
...
```

Make podman network list support several filters. Supported filters are name,
plugin, driver and label. Filters with different keys work exclusive. Several label
filters work exclusive and the other filter keys are working inclusive.

Also adjust the compat api to support labels in network create and list.

Breaking changes:

- podman network ls -f shortform is used for --filter instead --format
This matches docker and other podman commands (container ps, volume ps)

- libpod network list endpoint filter parameter is removed. Instead the
filters paramter should be used as json encoded map[string][]string.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-28 18:35:43 +01:00
Giuseppe Scrivano 3c6dca2f87
runtime: set XDG_* env variables if missing
regression introduced when moving to Podman 2.0.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1877228

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-11-27 14:33:50 +01:00
Daniel J Walsh f62a356515
Remove varlink support from Podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-26 16:50:42 -05:00
Paul Holzinger 2f7bca0685 Fix problems with network remove
First, make sure we are only trying to remove the network
interface if we are root.
Second, if we cannot get the interface name (e.g macvlan config)
then we should not fail. Just remove the config file.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-26 21:42:28 +01:00
Daniel J Walsh 20160af018
Switch from pkg/secrets to pkg/subscriptions
The buildah/pkg/secrts package was move to
containers/common/pkg/subscriptions.
Switch to using this by default.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-26 07:30:18 -05:00
Qi Wang 5231997f97 Not use local image create/add manifest
Avoid using the image from load storage for `manifest create` and `manifest add`
since the local image does not include other entries of the list from the registry.
`--all` flag of `manifest create` and `manifest add` can not add all of the lists as expected.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-11-24 15:54:41 -05:00
OpenShift Merge Robot 850bdd236a
Merge pull request #8467 from Luap99/fix-mac-custom-net
Fix custom mac address with a custom cni network
2020-11-24 18:48:32 +01:00
Paul Holzinger 9602e290de Fix custom mac address with a custom cni network
The cni plugin `tuning` is required to set a custom mac address.
This plugin is configured in the default cni config file which is
packaged with podman but was not included the generated config form
`podman network create`.

Fixes #8385

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-24 15:16:23 +01:00
baude 1ddb19bc8e update container status with new results
a bug was being caused by the fact that the container network results
were not being updated properly.

given that jhon is on PTO, this PR will replace #8362

Signed-off-by: baude <bbaude@redhat.com>
2020-11-23 15:20:39 -06:00
Jhon Honce 44da01f45c Refactor compat container create endpoint
* Make endpoint compatibile with docker-py network expectations
* Update specgen helper when called from compat endpoint
* Update godoc on types
* Add test for network/container create using docker-py method
* Add syslog logging when DEBUG=1 for tests

Fixes #8361

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-11-23 15:20:39 -06:00
OpenShift Merge Robot cd6c4cb0af
Merge pull request #8438 from MarcoPolo/marco/set-path-for-systemd-healthcheck
Set PATH env in systemd timer.
2020-11-23 21:33:05 +01:00
OpenShift Merge Robot 4b9b3783c7
Merge pull request #8451 from Luap99/fix-subnet-range
Fix ip-range for classless subnet masks
2020-11-23 19:34:41 +01:00
Marco Munizaga a8cb43d3a9 Set PATH env in systemd timer.
This fixes an issue where binaries that are in the path of the original
podman process are not found in the transient systemd timer for
healthchecks.

This showed up for me on a NixOS machine since binaries are not installed
in the usual places.

Signed-off-by: Marco Munizaga <git@marcopolo.io>
2020-11-23 10:26:02 -08:00
OpenShift Merge Robot dd343418ce
Merge pull request #8263 from rhatdan/restart
Allow containers to --restart on-failure with --rm
2020-11-23 13:44:37 +01:00
Paul Holzinger 70e7acdb23 Fix ip-range for classless subnet masks
The `LastIPInSubnet` function worked only for classful subnet
masks (e.g. /8, /16, /24). For non standard subnet masks this
returned the wrong ip address.

This works now for all subnet mask. A unit test is added to
ensure this.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-23 11:55:29 +01:00
Matthew Heon ce775248ad Make c.networks() list include the default network
This makes things a lot more clear - if we are actually joining a
CNI network, we are guaranteed to get a non-zero length list of
networks.

We do, however, need to know if the network we are joining is the
default network for inspecting containers as it determines how we
populate the response struct. To handle this, add a bool to
indicate that the network listed was the default network, and
only the default network.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-11-20 14:03:24 -05:00
Daniel J Walsh dc8996ec84
Allow containers to --restart on-failure with --rm
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-20 13:55:19 -05:00
Valentin Rothberg 1efb9b5e17 fix container cgroup lookup
When running on cgroups v1, `/proc/{PID}/cgroup` has multiple entries,
each pointing potentially to a different cgroup.  Some may be empty,
some may point to parents.

The one we really need is the libpod-specific one, which always is the
longest path.  So instead of looking at the first entry, look at all and
select the longest one.

Fixes: #8397
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-11-20 11:31:12 +01:00
OpenShift Merge Robot e239bfa15b
Merge pull request #8391 from baude/networkconnectdisconnect
add network connect|disconnect compat endpoints
2020-11-19 16:54:29 +01:00
baude a3e0b7d117 add network connect|disconnect compat endpoints
this enables the ability to connect and disconnect a container from a
given network. it is only for the compatibility layer. some code had to
be refactored to avoid circular imports.

additionally, tests are being deferred temporarily due to some
incompatibility/bug in either docker-py or our stack.

Signed-off-by: baude <bbaude@redhat.com>
2020-11-19 08:16:19 -06:00
Paul Holzinger e7fd9234cd Align the podman pod ps --filter behavior with podman ps
Filters with the same key work inclusive with the only exception being
`label` which is exclusive. Filters with different keys always work exclusive.

Also update the documentation with the new behavior.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-18 19:31:25 +01:00
OpenShift Merge Robot 61a82159db
Merge pull request #8376 from Luap99/podman-filters
Align the podman ps --filter behavior with docker
2020-11-18 18:55:05 +01:00
Paul Holzinger 4f427a89cb Align the podman ps --filter behavior with docker
All of our filters worked exclusive resulting in `--filter status=created --filter status=exited` to return nothing.

In docker filters with the same key work inclusive with the only exception being `label` which is exclusive. Filters with different keys always work exclusive.

This PR aims to match the docker behavior with podman.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-18 11:36:06 +01:00
zhangguanzhang 76a38fc3f2 Fix podman pod inspect show wrong MAC string
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-11-18 18:06:06 +08:00
baude d3e794bda3 add network connect|disconnect compat endpoints
this enables the ability to connect and disconnect a container from a
given network. it is only for the compatibility layer. some code had to
be refactored to avoid circular imports.

additionally, tests are being deferred temporarily due to some
incompatibility/bug in either docker-py or our stack.

Signed-off-by: baude <bbaude@redhat.com>
2020-11-17 14:22:39 -06:00
OpenShift Merge Robot 42ec4cf87f
Merge pull request #8290 from vrothberg/fix-8265
use container cgroups path
2020-11-17 14:00:09 +01:00
OpenShift Merge Robot 7d067afac7
Merge pull request #8347 from rhatdan/hostname
Make sure /etc/hosts populated correctly with networks
2020-11-17 12:45:50 +01:00
Valentin Rothberg 39bf07694c use container cgroups path
When looking up a container's cgroup path, parse /proc/[PID]/cgroup.
This will work across all cgroup managers and configurations and is
supported on cgroups v1 and v2.

Fixes: #8265
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-11-17 12:29:50 +01:00
Daniel J Walsh 4ca4234af1
Make sure /etc/hosts populated correctly with networks
The --hostname and containername should always be added to containers.

Added some tests to make sure you can always ping the hostname and container
name from within the container.

Fixes: https://github.com/containers/podman/issues/8095

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-16 16:40:50 -05:00
Paul Holzinger cf4967de4d Improve the shell completion api
One main advantage of the new shell completion logic is that
we can easly parse flags and adjust based on the given flags
the suggestions. For example some commands accept the
`--latest` flag only if no arguments are given.

This commit implements this logic in a simple maintainable way
since it reuses the already existing `Args` function in the
cmd struct.

I also refactored the `getXXX` function to match based on the
namei/id which could speed up the shell completion with many
containers, images, etc...

I also added the degraded status to the valid pod status
filters which was implemented in #8081.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-16 16:14:42 +01:00
Valentin Rothberg 8e4a42aa42 short-name aliasing
Add support for short-name aliasing.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-11-13 15:40:06 +01:00
OpenShift Merge Robot a65ecc70c2
Merge pull request #8304 from rhatdan/error
Cleanup error reporting
2020-11-12 22:33:25 +01:00
OpenShift Merge Robot 2aa6a8577d
Merge pull request #8298 from mheon/db_network_connect
Add support for network connect / disconnect to DB
2020-11-12 19:40:31 +01:00
OpenShift Merge Robot 39e3ec767a
Merge pull request #8307 from mheon/fix_8221
Ensure we do not double-lock the same volume in create
2020-11-12 16:11:30 +01:00
Matthew Heon 8d56eb5342 Add support for network connect / disconnect to DB
Convert the existing network aliases set/remove code to network
connect and disconnect. We can no longer modify aliases for an
existing network, but we can add and remove entire networks. As
part of this, we need to add a new function to retrieve current
aliases the container is connected to (we had a table for this
as of the first aliases PR, but it was not externally exposed).

At the same time, remove all deconflicting logic for aliases.
Docker does absolutely no checks of this nature, and allows two
containers to have the same aliases, aliases that conflict with
container names, etc - it's just left to DNS to return all the
IP addresses, and presumably we round-robin from there? Most
tests for the existing code had to be removed because of this.

Convert all uses of the old container config.Networks field,
which previously included all networks in the container, to use
the new DB table. This ensures we actually get an up-to-date list
of in-use networks. Also, add network aliases to the output of
`podman inspect`.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-11-11 16:37:54 -05:00
Matthew Heon 0f637e09da Ensure we do not double-lock the same volume in create
When making containers, we want to lock all named volumes we are
adding the container to, to ensure they aren't removed from under
us while we are working. Unfortunately, this code did not account
for a container having the same volume mounted in multiple places
so it could deadlock. Add a map to ensure that we don't lock the
same name more than once to resolve this.

Fixes #8221

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-11-11 16:06:03 -05:00
Daniel J Walsh f3648b4ae8
Cleanup error reporting
The error message reported is overlay complicated and the added test does not
really help the user.

Currently the error looks like:

podman run -p 80:80 fedora echo hello
Error: failed to expose ports via rootlessport: "cannot expose privileged port 80, you might need to add "net.ipv4.ip_unprivileged_port_start=0" (currently 1024) to /etc/sysctl.conf, or choose a larger port number (>= 1024): listen tcp 0.0.0.0:80: bind: permission denied\n"

After this change

./bin/podman run -p 80:80 fedora echo hello
Error: cannot expose privileged port 80, you might need to add "net.ipv4.ip_unprivileged_port_start=0" (currently 1024) to /etc/sysctl.conf, or choose a larger port number (>= 1024): listen tcp 0.0.0.0:80: bind: permission denied

Control chars have been eliminated.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-11 13:11:15 -05:00
OpenShift Merge Robot ce2ac7d2d2
Merge pull request #8251 from baude/networkaliases
network aliases for container creation
2020-11-10 19:10:59 +01:00