Commit graph

8750 commits

Author SHA1 Message Date
Matthew Heon 7a64ce35db Ensure that exec errors write exit codes to the DB
In local Podman, the frontend interprets the error and exit code
given by the Exec API to determine the appropriate exit code to
set for Podman itself; special cases like a missing executable
receive special exit codes.

Exec for the remote API, however, has to do this inside Libpod
itself, as Libpod will be directly queried (via the Inspect API
for exec sessions) to get the exit code. This was done correctly
when the exec session started properly, but we did not properly
handle cases where the OCI runtime fails before the exec session
can properly start. Making two error returns that would otherwise
not set exit code actually do so should resolve the issue.

Fixes #6893

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-08-05 14:30:48 -04:00
OpenShift Merge Robot 7a15be546a
Merge pull request #7168 from QiWang19/exec-fds
Fix close fds of exec --preserve-fds
2020-07-31 11:34:23 -04:00
Qi Wang 3fccb699e4 Fix close fds of exec --preserve-fds
Fix the closing of fds from --preserve-fds to avoid the operation on unrelated fds.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-07-31 08:27:12 -04:00
OpenShift Merge Robot 3cf8237bc0
Merge pull request #7120 from QiWang19/preserve-fd
Fix close fds of run --preserve-fds
2020-07-31 08:25:05 -04:00
OpenShift Merge Robot bb96c8918b
Merge pull request #7164 from giuseppe/volumes-chown-no-recurse
volumes: do not recurse when chowning
2020-07-31 07:19:02 -04:00
OpenShift Merge Robot e911875b6a
Merge pull request #7162 from giuseppe/add-rootless-checks
rootless: do not ignore errors if mappings are specified
2020-07-31 06:16:14 -04:00
Giuseppe Scrivano 10627228be
volumes: do not recurse when chowning
keep the file ownership when chowning and honor the user namespace
mappings.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-31 10:57:03 +02:00
OpenShift Merge Robot 0e009d5f80
Merge pull request #7159 from ashley-cui/runningfor
add {{.RunningFor}} placeholder in ps --format
2020-07-31 03:24:35 -04:00
OpenShift Merge Robot 1b784b4c35
Merge pull request #7161 from Luap99/fix#7160
fix swapped mem_usage/percent fields
2020-07-30 22:03:59 -04:00
Giuseppe Scrivano d188b2fe22
rootless: add a check for the host id included in the range
add a check to verify whether the additional IDs also contain the host
ID.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-30 23:16:50 +02:00
Paul Holzinger 2764d18751 fix swapped mem_usage/percent fields
Correct the wrong field assignment in `podman stats --format=json`.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-07-30 22:36:59 +02:00
Giuseppe Scrivano d86ef45441
rootless: child exits immediately on userns errors
if the parent process failed to create the user namespace, let the
child exit immediately.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-30 21:46:04 +02:00
Giuseppe Scrivano 8408cfd35c
rootless: do not ignore errors if mappings are specified
when setting up the user namespace do not ignore errors from
newuidmap/newgidmap if there are mappings configured.

The single user mapping is a fallback only when there are not mappings
specified for the user.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-30 21:43:09 +02:00
Ashley Cui 8e6a6197db add {{.RunningFor}} placeholder in ps --format
For docker compatibility

Signed-off-by: Ashley Cui <acui@redhat.com>
2020-07-30 15:33:22 -04:00
Qi Wang 57967414ae fix close fds of run --preserve-fds
Test flakes mentioned in #6987 might be caused by uncorrect closing of file descriptor.
Fix the code to close file descriptors for podman run since it may close those used by other processes.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-07-30 15:32:39 -04:00
OpenShift Merge Robot 4132b71478
Merge pull request #7156 from zhangguanzhang/master
fix podman system df format error
2020-07-30 15:14:49 -04:00
OpenShift Merge Robot ca2bda6420
Merge pull request #7155 from mheon/fix_rmi_force
Ensure that 'rmi --force' evicts Podman containers
2020-07-30 14:52:59 -04:00
zhangguanzhang b4fa2c2517 fix podman system df format error
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-07-31 01:40:42 +08:00
Matthew Heon 9f5a11cacc Ensure that 'rmi --force' evicts Podman containers
The logic for `podman rmi --force` includes a bit of code that
will remove Libpod containers using Libpod's container removal
logic - this ensures that they're cleanly and completely removed.
For other containers (Buildah, CRI-O, etc) we fall back to
manually removing the containers using the image from c/storage.

Unfortunately, our logic for invoking the Podman removal function
had an error, and it did not properly handle cases where we were
force-removing an image with >1 name. Force-removing such images
by ID guarantees their removal, not just an untag of a single
name; our code for identifying whether to remove containers did
not proper detect this case, so we fell through and deleted the
Podman containers as storage containers, leaving traces of them
in the Libpod DB.

Fixes #7153

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-30 12:01:05 -04:00
OpenShift Merge Robot 05b3e0e16b
Merge pull request #7151 from edsantiago/bats
System tests: new system-df and passwd tests
2020-07-30 10:43:12 -04:00
Ed Santiago 84f4b87c2e System tests: new system-df and passwd tests
- New test for #6991 - passwd file is writable even when
   run with --userns=keep-id

 - Enable another keep-id test, commented out due to #6593

 - New test for podman system df

Also, independently, removed this line:

   apt-get -y upgrade conmon

...because it's causing CI failures, probably because of the
boothole CVE, probably because the Ubuntu grub update was
rushed out. I believe it is safe to remove this, because
both Ubuntu 19 and 20 report:

   conmon is already the newest version (2.0.18~1).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-07-30 06:16:51 -06:00
OpenShift Merge Robot 117043040e
Merge pull request #7146 from rhatdan/format
Don't crash when giving bogus format commands
2020-07-30 06:13:51 -04:00
OpenShift Merge Robot c66ce8d67f
Merge pull request #7147 from rhatdan/history
Return NamesHistory when returning remote images
2020-07-29 16:12:51 -04:00
OpenShift Merge Robot d5ce1cd647
Merge pull request #7074 from mheon/multi_ctrport_ok
Binding the same container port to >1 host port is OK
2020-07-29 16:10:08 -04:00
OpenShift Merge Robot eaa2f524c2
Merge pull request #7143 from edsantiago/skip_flaky_binding_test
bindings: skip flaky pause/unpause test
2020-07-29 15:23:00 -04:00
OpenShift Merge Robot 044a7cb100
Merge pull request #6991 from mheon/change_passwd_ondisk
Make changes to /etc/passwd on disk for non-read only
2020-07-29 14:27:50 -04:00
OpenShift Merge Robot 77fb3d2c95
Merge pull request #7142 from edsantiago/logformat_fix_gitcommit
logformatter: more libpod-podman fallout
2020-07-29 14:25:04 -04:00
Matthew Heon ecefdab3d9 Binding the same container port to >1 host port is OK
The initial version of the new port code mistakenly restricted
this, so un-restrict it. We still need to maintain the map of
container ports, unfortunately (need to verify if the port in
question is a duplicate, for example).

Fixes #7062

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-29 14:24:36 -04:00
Daniel J Walsh 23294c9cf6
Return NamesHistory when returning remote images
We are returning bogus data in podman-remote images --format json.
This change will match the same data returned my podman images --format json.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-29 14:17:56 -04:00
Daniel J Walsh 9917fc0f95
Don't crash when giving bogus format commands
Currently if you give a bogus flag to --format it will crash
the formatter.  With this change we will get a nice error.

podman images --format '{{ bogus }}'
Error: template: list:1: function "bogus" not defined

versus
 /bin/podman.old images --format '{{ bogus }}'
panic: template: list:1: function "bogus" not defined

goroutine 1 [running]:

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-29 14:12:19 -04:00
Ed Santiago 52375c033a bindings: skip flaky pause/unpause test
The "podman wait to pause|unpause condition" test is failing
several times a day, always a flake. Issue #6518.

Disable it until the cause can be identified and fixed.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-07-29 11:30:09 -06:00
Ed Santiago 382af09784 logformatter: more libpod-podman fallout
Problem: formatted logs no longer have live links to sources
in error-report lines.

Cause: script was searching for '/libpod'.

Solution: make it more flexible.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-07-29 10:48:48 -06:00
OpenShift Merge Robot 7f38774ee7
Merge pull request #7131 from rhafer/image_search_descr
Fix `podman image search` missing description
2020-07-29 07:49:49 -04:00
OpenShift Merge Robot 83166a98c3
Merge pull request #7121 from rhatdan/build
Fix building from http or '-' options
2020-07-29 05:03:05 -04:00
Ralf Haferkamp cf5c63b5c4 Fix podman image search missing description
`podman image search` returned wrong results for the image "Description" as
it was mapped to the wrong field ("ID") in the search results.

Signed-off-by: Ralf Haferkamp <rhafer@suse.com>
2020-07-29 10:58:56 +02:00
OpenShift Merge Robot 7f0c0941e8
Merge pull request #6851 from rhatdan/mount
Add podman image mount
2020-07-29 04:30:01 -04:00
OpenShift Merge Robot 539bb4c592
Merge pull request #7109 from rhatdan/ipc
Specifying --ipc=host --pid=host is broken
2020-07-28 18:40:54 -04:00
OpenShift Merge Robot b0777adcac
Merge pull request #7110 from edsantiago/bats
System tests: add environment, volume tests
2020-07-28 17:52:08 -04:00
Daniel J Walsh bb4d269087
Specifying --ipc=host --pid=host is broken
For some reason we were overwriting memory when handling both
--pid=host and --ipc=host.  Simplified the code to handle this
correctly, and add test to make sure it does not happen again.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-28 14:53:54 -04:00
Daniel J Walsh a35045cbc4
Fix building from http or '-' options
When copying from a URL, podman will download and create a context
directory in a temporary file.  The problem was that this directory
was being removed as soon as the function that created it was returned.

Later the build code would look for content in the temporary directory
and fail to find it, blowing up the build.

By pulling the extraction code back into the build function, we keep the
temporary directory around until the build completes.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-28 14:51:21 -04:00
Ed Santiago 409d07a181 System tests: add environment, volume tests
Tests for #7094, in which symlinks in a volume would
cause chown errors and nonrunnable containers.

Tests for environment variable precedence, now
include --env-host and proxy settings

Fix a bug caught by covscan in helpers.t ('source'
path would fail if path included spaces).

Fix podman-run man page: it was incorrect in stating
precedence between in-image environment and --env-host.

Fixes: #7099

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-07-28 09:22:22 -06:00
Daniel J Walsh 6979d140f1
Add podman image mount
There are many use cases where you want to just mount an image
without creating a container on it. For example you might want
to just examine the content in an image after you pull it for
security analysys.  Or you might want to just use the executables
on the image without running it in a container.

The image is mounted readonly since we do not want people changing
images.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-28 10:27:44 -04:00
OpenShift Merge Robot 288ebec6e7
Merge pull request #6909 from rhatdan/podman
Switch all references to github.com/containers/libpod -> podman
2020-07-28 10:12:55 -04:00
OpenShift Merge Robot 6ed9868a34
Merge pull request #7098 from asottile/newline_on_error
add newline to output in error message
2020-07-28 09:23:19 -04:00
OpenShift Merge Robot ec69497b18
Merge pull request #7105 from AkihiroSuda/fix-cgroupversion-string
compat/info.go: TrimPrefix(CGroupsVersion, "v")
2020-07-28 15:01:37 +02:00
OpenShift Merge Robot 14f8085016
Merge pull request #7079 from rhatdan/tuturial
update configuration for rootless podman
2020-07-28 14:58:52 +02:00
OpenShift Merge Robot ecd84781d8
Merge pull request #7101 from AkihiroSuda/rootlesskit-010
Bump github.com/rootless-containers/rootlesskit from 0.9.5 to 0.10.0
2020-07-28 14:56:10 +02:00
Daniel J Walsh a5e37ad280
Switch all references to github.com/containers/libpod -> podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-28 08:23:45 -04:00
OpenShift Merge Robot 91c92d10fc
Merge pull request #7085 from rhatdan/cmount
Cleanup handling of podman mount/unmount
2020-07-28 14:03:22 +02:00
Akihiro Suda f657e5551e
compat/info.go: TrimPrefix(CGroupsVersion, "v")
For compatibility with Docker: 846b7e24ba/api/swagger.yaml (L4528-L4534)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-07-28 18:17:13 +09:00