Commit graph

11917 commits

Author SHA1 Message Date
Daniel J Walsh
90805fa39f Add support for podman remote build -f - .
Fixes: https://github.com/containers/podman/issues/10621

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-24 14:08:57 -04:00
zhangguanzhang
854c27c0a0 Fix panic condition in cgroups.getAvailableControllers
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2021-06-24 14:07:10 -04:00
Daniel J Walsh
b0dc157af9 Fix permissions on initially created named volumes
Permission of volume should match the directory it is being mounted on.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-24 14:05:12 -04:00
Chris Evich
f5cdb95eec Fix building static podman-remote
As near as I can tell, sometime between `v1.6.4` and `v1.9` the definition
of `LDFLAGS_PODMAN_STATIC` was both created and lost.  Additionally, after
a refactoring of the `Makefile` it was possible to enable CGO (which
will cause a dynamic binary to be built).  Fix both issues by adding the
missing definition and forcing CGO to be disabled.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-06-24 14:03:26 -04:00
Paul Holzinger
1c04cfe837 add correct slirp ip to /etc/hosts
The container name should have the slirp interface ip set in /etc/hosts
and not the gateway ip. Commit c8dfcce6db introduced this regression.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1972073

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-06-24 14:00:23 -04:00
Valentin Rothberg
6c4ee8535f disable tty-size exec checks in system tests
As discussed in #10710, the additional checks for podman-exec added by
commit 666f555aa5 are extremely flaky and appear in nearly every PR
I have see this week.

Let's temporarily disable the checks and reenable them on #10710 is
fixed.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-24 13:50:29 -04:00
Paul Holzinger
6ba9617be6 Fix resize race with podman exec -it
When starting a process with `podman exec -it` the terminal is resized
after the process is started. To fix this allow exec start to accept the
terminal height and width as parameter and let it resize right before
the process is started.

Fixes #10560

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-06-24 13:48:48 -04:00
Miloslav Trmač
eb6d4b0cfe Fix documentation of the --format option of podman push
It affects all transports; and without --format, we try several manifest formats.

[NO TESTS NEEDED]

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-06-24 13:47:21 -04:00
Max Goltzsche
e5c939183a Fix systemd-resolved detection.
Previously podman failed when run in an environment where 127.0.0.53 is
the only nameserver but systemd-resolved is not used directly.
In practice this happened when podman was run within an alpine container
that used the host's network and the host was running systemd-resolved.

This fix makes podman ignore a file not found error when reading /run/systemd/resolve/resolv.conf.

Closes #10733

[NO TESTS NEEDED]

Signed-off-by: Max Goltzsche <max.goltzsche@gmail.com>
2021-06-24 13:43:40 -04:00
cdoern
613f427a03 Health Check is not handled in the compat LibpodToContainerJSON
Added parsing and handling for the healthCheck status within containers.go. Also modified tests

fixes #10457

Signed-off-by: cdoern <cbdoer23@g.holycross.edu>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-06-24 13:42:13 -04:00
Paul Holzinger
949573c5a8 Do not use inotify for OCICNI
Podman does not need to watch the cni config directory. If a network is
not found in the cache, OCICNI will reload the networks anyway and thus
even podman system service should work as expected.
Also include a change to not mount a "new" /var by default in the
rootless cni ns, instead try to use /var/lib/cni first and then the
parent dir. This allows users to store cni configs under /var/... which
is the case for the CI compose test.

[NO TESTS NEEDED]

Fixes #10686

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-06-24 13:39:24 -04:00
Paul Holzinger
ab5e770c4b getContainerNetworkInfo: lock netNsCtr before sync
`syncContainer()` requires the container to be locked, otherwise we can
end up with undefined behavior.

[NO TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-06-24 13:38:07 -04:00
Urvashi Mohnani
b957bff8b5 [NO TESTS NEEDED] Create /etc/mtab with the correct ownership
Create the /etc and /etc/mtab directories with the
correct ownership based on what the UID and GID is
for the container. This was causing issue when starting
the infra container with userns as the /etc directory
wasn't being created with the correct ownership.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2021-06-24 13:32:06 -04:00
Daniel J Walsh
6d394f0e47 Create the /etc/mtab file if does not exists
We should create the /etc/mtab->/proc/mountinfo link
so that mount command will work within the container.

Docker does this by default.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-24 13:30:50 -04:00
OpenShift Merge Robot
f8a793a72d
Merge pull request #10775 from vrothberg/3.2-fix-cp
[v3.2] cp: do not allow dir->file copying
2021-06-24 10:35:12 -04:00
Valentin Rothberg
879d66e7db [v3.2] cp: do not allow dir->file copying
Fix a bug in `podman-cp` to forbid copying directories to files.
Previously, the directory was copied to the parent directory of the file
which is wrong.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-24 14:58:11 +02:00
OpenShift Merge Robot
3ee967bd5d
Merge pull request #10763 from vrothberg/3.2-backports
3.2 backports
2021-06-24 05:40:08 -04:00
Valentin Rothberg
6f769bc0e9 create: support images with invalid platform
Much to my regret, there is a number of images in the wild with invalid
platforms breaking the platform checks in libimage that want to make
sure that a local image is matching the expected platform.

Imagine a `podman run --arch=arm64 fedora` with a local amd64 fedora
image.  We really shouldn't use the local one in this case and pull down
the arm64 one.

The strict platform checks in libimage in combination with invalid
platforms in images surfaced in Podman being able to pull an image but
failing to look it up in subsequent presence checks.  A `podman run`
would hence pull such an image but fail to create the container.

Support images with invalid platforms by vendoring the latest HEAD from
containers/common.  Also remove the partially implemented pull-policy
logic from Podman and let libimage handle that entirely.  However,
whenever --arch, --os or --platform are specified, the pull policy will
be forced to "newer".  This way, we pessimistically assume that the
local image has an invalid platform and we reach out to the registry.
If there's a newer image (i.e., one with a different digest), we'll pull
it down.

Please note that most of the logic has either already been implemented
in libimage or been moved down which allows for removing some clutter
from Podman.

[NO TESTS NEEDED] since c/common has new tests.  Podman can rely on the
existing tests.

Fixes: #10648
Fixes: #10682
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-24 10:15:56 +02:00
Valentin Rothberg
19a89db661 vendor containers/common@v0.38.10
Please refer to the individual commits for further details:

* libimage: pull: override even --pull=never with custom platfo
* libimage: pull: enforce pull policy for custom platforms
* libimage: pull: ignore platform for local image lookup
* Allow /etc/containers/containers.conf to be read by non-root
* [0.38] libimage: force remove: only untag on multi tag image

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-24 08:47:48 +02:00
OpenShift Merge Robot
7d8f111245
Merge pull request #10744 from vrothberg/v3.2-fix-10682
[v3.2]  logs: k8s-file: restore poll sleep
2021-06-22 09:14:07 -04:00
Valentin Rothberg
e5c070baff logs: k8s-file: restore poll sleep
Commit 84b55eec27 attempted to fix a race waiting for the container
died event.  Previously, Podman slept for duration of the polling
frequence which I considerred to be a mistake.  As it turns out, I was
mistaken since the file logger will, in fact, NOT read until EOF and
then stop logging but stop logging immediately _after_ it woke up.

[NO TESTS NEEDED] as the race condition cannot be hit reliably.

Fixes: #10675
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-22 13:18:04 +02:00
Valentin Rothberg
4d9a9149dd logs: k8s-file: fix spurious error logs
Fix the suprious "Error: nil" messages.  Also add some more context to
logged error messages which makes error sources more obvious.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-22 13:18:04 +02:00
OpenShift Merge Robot
017116242d
Merge pull request #10751 from vrothberg/v3.2-backport-969cc3237be5
[v3.2] utils: move message from warning to debug
2021-06-22 07:17:08 -04:00
Giuseppe Scrivano
dac2d31a24 utils: move message from warning to debug
if a pid could not be moved to a new cgroup, print a debug message
instead of a warning.

Backport of commit 969cc3237b.

[NO TESTS NEEDED]

Closes: https://github.com/containers/podman/issues/10674
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-22 11:18:46 +02:00
OpenShift Merge Robot
ab4d0cf908
Merge pull request #10658 from mheon/bump_321
Bump to v3.2.1
2021-06-14 13:13:02 -04:00
Matthew Heon
60752b3206 Bump to v3.2.2-dev
Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-06-14 10:35:09 -04:00
Matthew Heon
152952fe6b Bump to v3.2.1
Also, revert minimum API version for the Libpod remote API to
v3.1.0.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-06-14 10:35:09 -04:00
Matthew Heon
c5d9c0a6fa Updated release notes for v3.2.1
Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-06-14 10:35:09 -04:00
Paul Holzinger
4f56f7f133 Fix network connect race with docker-compose
Network connect/disconnect has to call the cni plugins when the network
namespace is already configured. This is the case for `ContainerStateRunning`
and `ContainerStateCreated`. This is important otherwise the network is
not attached to this network namespace and libpod will throw errors like
`network inspection mismatch...` This problem happened when using
`docker-compose up` in attached mode.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-06-14 10:35:09 -04:00
Matthew Heon
e42d727a97 Revert "Ensure minimum API version is set correctly in tests"
This reverts commit 9647d88449. We
reverted the API bump (was a mistake, should have been left at
3.1.0) and now we need to revert the test changes.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-06-14 10:35:09 -04:00
Alex Schultz
f69789155a Fall back to string for dockerfile parameter
a9cb824981 changed the expectations of the
dockerfile parameter to be json data however it's a string. In order to
support both, let's attempt json and fall back to a string if the json
parsing fails.

Closes #10660

Signed-off-by: Alex Schultz <aschultz@redhat.com>
2021-06-14 10:34:35 -04:00
Valentin Rothberg
5a158563c0 remote events: fix --stream=false
Fix a bug in remote events where only one event would be sent if when
streaming is turned off.  The source of the bug was that the handler
attempted to implement the streaming logic and did it wrong.  The fix is
rather simple by removing this logic from the handler and let the events
backend handle streaming.

Fixes: #10529
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-11 13:06:07 -04:00
Paul Holzinger
38fbd2cb9e [CI:DOCS] fix incorrect network remove api doc
The endpoint returns an array and not a single entry.

Fixes #10494

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-06-11 13:06:07 -04:00
Paul Holzinger
26eae3bf89 remote: always send resize before the container starts
There is race condition in the remote client attach logic. Because the
resize api call was handled in an extra goroutine the container was
started before the resize call happend. To fix this we have to call
resize in the same goroutine as attach. When the first resize is done
start a goroutine to listen on SIGWINCH in the background and resize
again if the signal is received.

Fixes #9859

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

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-06-11 13:06:07 -04:00
Valentin Rothberg
c751544fac remote events: support labels
Certain event meta data was lost when converting the remote events to
libpod events and vice versa.  Enable the skipped system tests for
remote.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-11 13:06:07 -04:00
Paul Holzinger
c28f442b28 remote pull: cancel pull when connection is closed
If a client closes the http connection during image pull, the
service should cancel the pull operation.

[NO TESTS NEEDED] I have no idea how we could test this reliable.

Fixes: #7558

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-06-11 13:06:07 -04:00
Paul Holzinger
2993bdf1ef Fix network prune api docs
The api doc used wrong response examples for both the compat and libpod
network prune endpoints. Change the doc so that it matches the actual
return values. Also fix the endpoints to return an empty array instead
of null when no networks are removed.

[NO TESTS NEEDED]

Fixes: #10564

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-06-11 13:06:06 -04:00
Paul Holzinger
8ba0c92e6a Improve systemd-resolved detection
When 127.0.0.53 is the only nameserver in /etc/resolv.conf assume
systemd-resolved is used. This is better because /etc/resolv.conf does
not have to be symlinked to /run/systemd/resolve/stub-resolv.conf in
order to use systemd-resolved.

[NO TESTS NEEDED]

Fixes: #10570

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-06-11 13:06:06 -04:00
Valentin Rothberg
c3f6ef63a2 logs: k8s-file: fix race
Fix a race in the k8s-file logs driver.  When "following" the logs,
Podman will print the container's logs until the end.  Previously,
Podman logged until the state transitioned into something non-running
which opened up a race with the container still running, possibly in
the "stopping" state.

To fix the race, log until we've seen the wait event for the specific
container.  In that case, conmon will have finished writing all logs to
the file, and Podman will read it until EOF.

Further tweak the integration tests for testing `logs -f` on a  running
container.  Previously, the test only checked for one of two lines
stating that there was a race.  Indeed the race was in using `run --rm`
where a log file may be removed before we could fully read it.

Fixes: #10596
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-11 13:06:06 -04:00
Jakub Guzik
f1e7a07473 Fix image prune --filter cmd behavior
Image prune --filter is fully implemented in the api, http api
yet not connected with the cli execution. User trying to use
filters does not see the effect. This commit adds glue code to enable
possiblity of using --filter in prune in the cli execution.

Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-06-11 13:06:06 -04:00
Paul Holzinger
5ddd76edd0 Several shell completion fixes
- fix network filters
- add prune filters
- pod create --share support comma separated namespaces

[NO TESTS NEEDED]

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-06-11 13:06:06 -04:00
Daniel J Walsh
2afb5eeab6 podman-remote build should handle -f option properly
podman-remote build has to handle multiple different locations
for the Containerfile.  Currently this works in local mode but not
when using podman-remote.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-11 11:14:04 -04:00
Ed Santiago
6beae86f01 System tests: deal with crun 0.20.1
crun 0.20.1 changed an error message that we relied on. Deal
with it by accepting the old and new message.

Also (unrelated): sneak in some doc fixes to get rid of
nasty go-md2man warnings that have crept into man pages.

Signed-off-by: Ed Santiago <santiago@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-06-11 11:09:42 -04:00
Paul Holzinger
80362b34c4 Fix build tags for pkg/machine...
Podman machine is only intended for amd64 and arm64 architectures, set
the correct buildtags so that the `pkg/machine`, `pkg/machine/qemu` and
`pkg/machine/libvirt` packages compile correctly.

[NO TESTS NEEDED]

Fixes #10625

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-06-11 11:08:18 -04:00
Adrian Reber
c85b6b3fe1 Fix pre-checkpointing
Unfortunately --pre-checkpointing never worked as intended and recent
changes to runc have shown that it is broken.

To create a pre-checkpoint CRIU expects the paths between the
pre-checkpoints to be a relative path. If having a previous checkpoint
it needs the be referenced like this: --prev-images-dir ../parent

Unfortunately Podman was giving runc (and CRIU) an absolute path.

Unfortunately, again, until March 2021 CRIU silently ignored if
the path was not relative and switch back to normal checkpointing.

This has been now fixed in CRIU and runc and running pre-checkpoint
with the latest runc fails, because runc already sees that the path is
absolute and returns an error.

This commit fixes this by giving runc a relative path.

This commit also fixes a second pre-checkpointing error which was just
recently introduced.

So summarizing: pre-checkpointing never worked correctly because CRIU
ignored wrong parameters and recent changes broke it even more.

Now both errors should be fixed.

[NO TESTS NEEDED]

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Adrian Reber <adrian@lisas.de>
2021-06-11 11:06:56 -04:00
Giuseppe Scrivano
b61701acb3 container: ignore named hierarchies
when looking up the container cgroup, ignore named hierarchies since
containers running systemd as payload will create a sub-cgroup and
move themselves there.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-06-11 11:05:09 -04:00
OpenShift Merge Robot
41fcd4d8ed
Merge pull request #10636 from vrothberg/v3.2-vendor-common
[v3.2] vendor containers/common@v0.38.9
2021-06-10 16:10:18 -04:00
Valentin Rothberg
e0dcffa8d1 [v3.2] vendor containers/common@v0.38.9
The fixes will allow for creating containers with a corrupted image in
which case the image will be repulled.

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1966872
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-10 18:31:17 +02:00
OpenShift Merge Robot
3d21dfe484
Merge pull request #10631 from giuseppe/v32-fix-rootless-join
[v3.2] rootless: fix fast join userns path
2021-06-10 09:40:17 -04:00
Giuseppe Scrivano
d46deca8c8
rootless: fix fast join userns path
commit ab88632835 changed the path for
the pause.pid file but didn't update the same path in the C code.
This prevented Podman to take the fast path when the userns is already
created and to join it without re-execing itself.

Fix the path in the C code as well so we can join the rootless
user+mount namespace without having to re-exec Podman.

[NO TESTS NEEDED]

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 11badab046)
2021-06-10 09:26:06 +02:00