Commit graph

13041 commits

Author SHA1 Message Date
Shion Tanaka
658d133390 Fixed the containerfile not found during remote build.
[NO NEW TESTS NEEDED]

Signed-off-by: Shion Tanaka <shtanaka@redhat.com>
2021-12-06 15:44:14 -05:00
Giuseppe Scrivano
aa9799b81f container, cgroup: detect pid termination
If the /proc/$PID/cgroup file doesn't exist, then it is likely the
container was terminated in the meanwhile so report ErrCtrStopped that
is already handled instead of ENOENT.

commit a66f40b4df introduced the regression.

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

[NO NEW TESTS NEEDED] it solves a race in the CI that is difficult to reproduce.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-06 15:39:38 -05:00
Valentin Rothberg
39318f1779 top: parse ps(1) args correctly
The arguments of ps(1) should be shlexed.

Fixes: #12452
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-06 15:38:10 -05:00
Daniel J Walsh
e1cf9d4c28 Only open save output file with WRONLY
The previous code fails on a MAC when opening /dev/stdout

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

[NO NEW TESTS NEEDED] No easy way to test this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-06 15:35:50 -05:00
Daniel J Walsh
e2d6948157 List /etc/containers/certs.d as default for --cert-path
Helps Document https://github.com/containers/podman/issues/10116

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-06 15:35:19 -05:00
Daniel J Walsh
75fc7e43e0 Move the chown to after the ADDs
I have noticed that the containers.conf file in the /home/podman
directory is owned by root and not Podman. This change fixes the
ownership.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-06 15:34:37 -05:00
Aditya Rajan
ab5ca6f759 compat: Add compatiblity with Docker/Moby API for scenarios where build fails
In order to maintain compatiblity with `moby API` we must the field
`errorDetail` which is primary error reporting field with stream.

Currently podman is using `error` which is already deprecated by moby.

Check: https://github.com/moby/moby/blob/master/pkg/jsonmessage/jsonmessage.go#L147

[NO NEW TESTS NEEDED]
We can't test this in podman CI since we dont have a docker client.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-06 15:33:29 -05:00
Matej Vasek
7b8e66de0b fix: parsing of HostConfig.Mounts for container create
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-12-06 15:32:15 -05:00
Matej Vasek
741d98fade fix: error reporting for archive endpoint
Returning 500 when copying to read-only destination.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-12-06 15:27:55 -05:00
Giuseppe Scrivano
905eabf0be libpod: improve heuristic to detect cgroup
improve the heuristic to detect the scope that was created for the container.
This is necessary with systemd running as PID 1, since it moves itself
to a different sub-cgroup, thus stats would not account for other
processes in the same container.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-06 15:26:18 -05:00
Giuseppe Scrivano
e3a50e7609 libpod, inspect: export cgroup path
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-06 15:25:07 -05:00
Giuseppe Scrivano
5f9f3bbea0 stats: get the memory limit from the spec
OCI runtimes may set the memory limits in different ways, e.g., crun
creates a sub-cgroup where the limits are applied, while runc applies
them directly on the created cgroup.  Since there is standardization
on the cgroup path to use, just use the limit specified in the spec
file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-06 15:25:00 -05:00
Aditya Rajan
05a5fcb45b oci: ack crun output when container is not there
`crun status ctrid` outputs `No such file or directory` when container
is not there so podman much ack it.

[NO NEW TESTS NEEDED]

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-06 15:20:28 -05:00
Aditya Rajan
c5530591bb oci: exit gracefully if container is already dead
While trying to kill a container with a `signal` we cant do anything if
container is already dead so `exit` gracefully instead of trying to
delete container again. Get container status from runtime.

[ NO NEW TESTS NEEDED ]

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-06 15:20:21 -05:00
Urvashi Mohnani
4a7af72ea9 Add note about volume with unprivileged container
Add a note to the generated kube yaml if we detect a
volume is being mounted. The note lets the user know
what needs to be done to avoid permission denied error
when trying to access the volume for an unprivileged
container.
Add the same note to the man pages.

NO NEW TESTS NEEDED

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2021-12-06 15:17:57 -05:00
Aditya Rajan
ca518ecdee swagger: add layers to build api docs
Add missing `layer` entry to swagger docs for `/build`.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-06 15:16:10 -05:00
Aditya Rajan
a10963f2e5 compat: add layer caching compatiblity for non podman clients
Non-podman clients do not set `layers` while making request. This is
supposed to be `true` bydefault but `non-podman-clients i.e Docker` dont
know about this field as a result they end up setting this values to
`false`. Causing builds to never use cache for layers.

Adds compatiblity for `docker SDK`.

[NO NEW TESTS NEEDED]

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-06 15:16:03 -05:00
Paul Holzinger
4f58790488 fix duplicated logs command
Podman logs was defined twice, once for container logs and once for pod
logs. This causes problems with the shell completion. Also podman --help
showed this command twice.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-06 15:12:49 -05:00
Michael Scherer
2c7b673c5c Change error message for compatibility with docker
Fix #12315

Signed-off-by: Michael Scherer <misc@redhat.com>
2021-12-06 15:11:08 -05:00
Paul Holzinger
76fd7dbd15 podman machine start wait for ssh
Wait for sshd to be ready before we return from start. This should make
podman machine ssh immediately available without any race conditions.

Fixes #11532

[NO NEW TESTS NEEDED] I could not reproduce the issue so I am not sure
if this fixes it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-06 15:03:07 -05:00
etenzy
0282f98b3c fix: take absolute path for dd on apple silicon
Fixes #12329

[NO NEW TESTS NEEDED] podman machine

Signed-off-by: Michael Rödel <hello@mroedel.de>
2021-12-06 15:00:47 -05:00
Giuseppe Scrivano
b5ded05f98 rootless: drop strerror(errno) calls
*printf functions already support printing the errno string with %m

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-06 15:00:29 -05:00
Giuseppe Scrivano
a92b71333e rootless: reuse existing open_namespace function
there is already a function for opening a namespace path, reuse it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-06 15:00:23 -05:00
Giuseppe Scrivano
8e6ee43bb2 rootless: use auto cleanup functions
simplify code using auto cleanup functions

[NO NEW TESTS NEEDED] it is a refactoring of existing code

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-06 15:00:16 -05:00
Hironori Shiina
6d9c1d8fdc Set flags to test 'logs -f' with journald driver
`logs -f` with `journald` is supported only when `journald` events
backend is used. To pass system tests using `logs -f` in an environment
where `events_logger` is not set to `journald` in `containers.conf`,
this fix sets `--events-backend` or `--log-driver` temporally.

Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-06 14:53:27 -05:00
Aditya Rajan
db6b9131ef secret: honor custom target for secrets with run
Honor custom `target` if specified while running or creating containers
with secret `type=mount`.

Example:
`podman run -it --secret token,type=mount,target=TOKEN ubi8/ubi:latest
bash`

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-06 14:37:46 -05:00
Nalin Dahyabhai
08bcd60c8f journald logs: keep reading until the journal's end
When reading logs from the journal, keep going after the container
exits, in case it gets restarted.

Events logged to the journal via the normal paths don't include
CONTAINER_ID_FULL, so don't bother adding it to the "history" event we
use to force at least one entry for the container to show up in the log.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-12-06 14:34:25 -05:00
Daniel J Walsh
76ada2c011 Error logs --follow if events-backend != journald, event-logger=journald
Fixes: https://github.com/containers/podman/issues/11255

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-06 14:31:01 -05:00
Giuseppe Scrivano
579d91c2f9 libpod: create /etc/mtab safely
make sure the /etc/mtab symlink is created inside the rootfs when /etc
is a symlink.

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

[NO NEW TESTS NEEDED] there is already a test case

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-06 14:26:10 -05:00
Michael Scherer
4ed07fb67d Always create working directory when using compat API
Docker/Moby always create the working directory, and some tools
rely on that behavior (example, woodpecker/drone).

Fixes #11842

Signed-off-by: Michael Scherer <misc@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-06 14:24:06 -05:00
Paul Holzinger
18e9ae59ca Fix network mode in play kube
We need to use the config network mode when no network mode was set. To
do so we have to keep the nsmode empty, MakeContainer() will use the
correct network mode from the config when needed.

Fixes #12248

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-06 14:21:17 -05:00
Matthew Heon
8dc94f1be5 Bump to containers/image v5.17.0
This resolves CVE-2021-41190

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-06 13:55:54 -05:00
Matthew Heon
274a76e068 Update release notes for changes already in branch
Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-06 13:54:06 -05:00
OpenShift Merge Robot
1aeb61cf5c
Merge pull request #12517 from Luap99/machine-dns
podman machine: use gvproxy for host.containers.internal
2021-12-06 17:03:24 +00:00
Paul Holzinger
4573196ae7
podman machine: use gvproxy for host.containers.internal
Let the gvproxy dns server handle the host.containers.internal entry.
Support for this is already added to gvproxy. [1]

To make sure the container uses the dns response from gvproxy we should
not add host.containers.internal to /etc/hosts in this case.

[NO NEW TESTS NEEDED] podman machine has no tests

Fixes #11642

[1] 1108ea4516

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-06 14:19:39 +01:00
OpenShift Merge Robot
fe44757e0b
Merge pull request #12497 from mheon/fix_2021_4024
Fix CVE-2021-4024 - v3.4 branch
2021-12-03 18:52:46 +00:00
Matthew Heon
57c5e2246e Swap bind address for gvproxy to localhost-only
This resolves CVE-2021-4024, where an attacker could access the
API externally and forward any port they desired to the VM from
`podman machine`.

[NO NEW TESTS NEEDED] gvproxy is not tested directly at this
time.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-12-03 09:50:51 -05:00
OpenShift Merge Robot
815f36af1a
Merge pull request #12463 from vrothberg/backport-12449
[3.4] systemd: replace multi-user with default.target
2021-12-01 18:17:14 +01:00
Valentin Rothberg
3912484569 systemd: replace multi-user with default.target
Replace multi-user.target with default.target across the code base.
It seems like the multi-user one is not available for (rootless) users
on F35 anymore is causing issues in all kinds of ways, for instance,
enabling the podman.service or generated systemd units.

Backport of commit 9a10e2124b.

Fixes: #12438
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-01 09:41:37 +01:00
OpenShift Merge Robot
31bc3586be
Merge pull request #12451 from vrothberg/backport-12064
[v3.4] container create: fix --tls-verify parsing
2021-11-30 16:12:23 +01:00
Valentin Rothberg
47a8e7c9f9 container create: fix --tls-verify parsing
Make sure that the value is only set if specified on the CLI.  c/image
already defaults to true but if set in the system context, we'd skip
settings in the registries.conf.

Backport of commit ff31f2264d.

Fixes: #11933
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-11-30 14:48:26 +01:00
OpenShift Merge Robot
67d5b21f66
Merge pull request #12447 from jakub-dzon/env-config-maps-backport
Support env variables based on ConfigMaps sent in payload
2021-11-30 12:52:21 +01:00
Jakub Dzon
b517f86334 Support env variables based on ConfigMaps sent in payload
Fixes #12363

Signed-off-by: Jakub Dzon <jdzon@redhat.com>
2021-11-30 10:44:30 +01:00
OpenShift Merge Robot
e3a7a743c5
Merge pull request #12383 from edsantiago/flake_fixes
[v3.4] backport Flake fixes
2021-11-22 18:59:30 +01:00
Valentin Rothberg
fe30b30458 fix CI
[Backport #12343, which fixes the change in fedora-minimal image]

Our fedora-minimal image on Quay bases on fedora-minimal:latest which
starting with F35 removed a number of binaries that our CI depends on.
Fix that by pulling `fedora-minimal:34` from the Fedora registry
directly.

Once the build bot on Quay has been disabled, we move the image over
there to make sure that it will not change over time.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-11-22 09:30:01 -07:00
Giuseppe Scrivano
2d265da0ec utils: use podman-pause-$RANDOM.scope name
[Backport of #12323 into v3.4, to fix gating-test flakes]

we try hard to re-use the existing podman-pause.scope name when it
already exists, causing any sort of race errors when the already
existing scope is terminating.

There is no such a requirement though, so just try with a random
name.

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

[NO NEW TESTS NEEDED] it fixes a race in the CI

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-11-22 08:25:10 -07:00
Ed Santiago
36b6bf119e Network test: fix podman-remote-rootless corner case
[Backport of #12297 into v3.4, to fix gating-test failures]

Followup to #12229, in which I added a podman unshare for
flake debugging. Turns out that doesn't work in podman-remote.
It was not caught because CI doesn't run podman-remote rootless.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-22 08:24:44 -07:00
OpenShift Merge Robot
72031783c5
Merge pull request #12327 from zeha/backport-11976
Backport #11976 to 3.4
2021-11-17 17:08:36 +01:00
Jhon Honce
25f35ac9e8 Use CGO_ENABLED=1 when building natively on darwin
Need to use CGO for mDNS resolution, but cross builds need CGO disabled
See https://github.com/golang/go/issues/12524 for details

Note: Homebrew forumla will need to be updated to pick up this change

Fixes #10737

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-11-17 11:51:33 +01:00
OpenShift Merge Robot
4808a63e5f
Merge pull request #12274 from mheon/bump_342
Bump to v3.4.2
2021-11-12 19:37:46 +01:00