Commit graph

3367 commits

Author SHA1 Message Date
Daniel J Walsh
8887cc7e44 podman run --memory=0 ... should not set memory limit
On Docker this is ignored, and it should be on Podman as
well. This is documented in the man page.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-12 11:08:25 -05:00
Stefan Weil
34739f4413 Replace 'an user' => 'a user'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-11-12 11:08:25 -05:00
Valentin Rothberg
9e78185e37 volumes: be more tolerant and fix infinite loop
Make Podman more tolerant when parsing image volumes during container
creation and further fix an infinite loop when checking them.

Consider `VOLUME ['/etc/foo', '/etc/bar']` in a Containerfile.  While
it looks correct to the human eye, the single quotes are wrong and yield
the two volumes to be `[/etc/foo,` and `/etc/bar]` in Podman and Docker.

When running the container, it'll create a directory `bar]` in `/etc`
and a directory `[` in `/` with two subdirectories `etc/foo,`.  This
behavior is surprising to me but how Docker behaves.  We may improve on
that in the future.  Note that the correct way to syntax for volumes in
a Containerfile is `VOLUME /A /B /C` or `VOLUME ["/A", "/B", "/C"]`;
single quotes are not supported.

This change restores this behavior without breaking container creation
or ending up in an infinite loop.

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2014149
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-11-08 10:17:06 +01:00
Aditya Rajan
5c2d17e1c1
[backport] tag: Support tagging manifest list instead of resolving to images
Following commit makes sure when buildah tag is invoked on a manifest
list, it tags the same manifest list instead of resolving to an image and
tagging it.

Backporting https://github.com/containers/podman/pull/12057

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-11-01 17:15:59 +05:30
Daniel J Walsh
b5dd62f315 Don't use docker/pkg/archive, use containers/storage/pkg/archive
[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-10-19 15:56:35 -04:00
Giuseppe Scrivano
b470de05b0 cgroups: use cgroup.controllers to read controllers
use the cgroup.controllers file instead of cgroup.subtree_control to
read the list of controllers available in the current cgroup.

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

[NO TESTS NEEDED] we have disabled this test in the CI because it is
difficult to know what controllers are going to be enabled for
rootless under all conditions we test.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-10-19 15:56:35 -04:00
Jhon Honce
8b87793d48 Use SplitN(2) when copying env variables
Environment variables whose value contained an equal sign where
truncated

Fixes #11891

Signed-off-by: Jhon Honce <jhonce@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-10-19 15:56:35 -04:00
Paul Holzinger
fbe94088fd podman stats: move cgroup validation to server
Podman stats is not supported for rootless cgroupv1 setups. The check
for this must be on the server side and not the client.

[NO NEW TESTS NEEDED] we cannot test this because remote and server are
always on the same machine in CI

Fixes #11909

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-10-19 15:56:35 -04:00
Reinhard Tartler
338e01f048 [CI:DOCS] oci-hooks.5.md: fixup section in header
This fixes the autodetection of where to install the manpages

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2021-10-19 15:56:35 -04:00
Matthew Heon
ca33df1468 Ensure podman ps --sync functions
The backend for `ps --sync` has been nonfunctional for a long
while now - probably since v2.0. It's questionable how useful the
flag is in modern Podman (the original case it was intended to
catch, Conmon gone via SIGKILL, should be handled now via pinging
the process with a signal to ensure it's still alive) but having
the ability to force a refresh of container state from the OCI
runtime is still useful.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-10-19 14:13:59 -04:00
Paul Holzinger
2cd206d0fc libpod: fix race when closing STDIN
There is a race where `conn.Close()` was called before `conn.CloseWrite()`.
In this case `CloseWrite` will fail and an useless error is printed. To
fix this we move the the `CloseWrite()` call to the same goroutine to
remove the race. This ensures that `CloseWrite()` is called before
`Close()` and never afterwards.
Also fixed podman-remote run where the STDIN was never was closed.
This is causing flakes in CI testing.

[NO TESTS NEEDED]

Fixes #11856

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

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-10-19 14:08:58 -04:00
Jhon Honce
62d12a2adf Add guard for BuildOptions.CommonBuildOpts
Existing images.Build() bindings code panicked when field was not
initialized.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-10-19 14:02:10 -04:00
Aditya Rajan
c6be71486d machine: silently cleanup dangling sockets before rm if possible
Try to cleanup dandling pid and machine socket if possible silently
before `rm`.

[NO TESTS NEEDED]

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-10-19 14:01:27 -04:00
Urvashi Mohnani
14509a92bb Allow a value of -1 to set unlimited pids limit
Users can set --pids-limit to -1 now to set unlimited
pids limit for a container - this matches the convention.

[NO TESTS NEEDED]

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2021-10-19 13:55:41 -04:00
Brent Baude
128e168be5 Support selinux options with bind mounts play/gen
When using play kube and generate kube, we need to support if bind
mounts have selinux options.  As kubernetes does not support selinux in
this way, we tuck the selinux values into a pod annotation for
generation of the kube yaml.  Then on play, we check annotations to see
if a value for the mount exists and apply it.

Fixes BZ #1984081

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-09-30 12:06:18 -05:00
Jason T. Greene
2247d5f1b8 Disable docker and alias to podman in FCOS ignition
Signed-off-by: Jason Greene <jason.greene@redhat.com>
Co-authored-by: Dusty Mabe <dusty@dustymabe.com>
2021-09-29 16:39:29 -04:00
Ashley Cui
4fc40c82f7 Remind user to check connection or use podman machine
Remind user to check their remote linux connection or use podman
machine. Move the warning from bindings to cmd/podman.

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-09-29 16:39:29 -04:00
Aditya Rajan
b3af5a92cc stop: Do nothing if container was never created in runtime
Following commit ensures we silently return container id on `stop` if
container was never created in OCI runtime.

Following behaviour ensures that we are in parity with docker.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-09-29 16:39:29 -04:00
Nalin Dahyabhai
7bfc5250d8 remote build: EvalSymlinks() the context directory
Use EvalSymlinks() to find the context directory, in case there's
shenanigans.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-09-29 16:39:29 -04:00
Paul Holzinger
7395459c76 podman machine: do not join userns
The go logic already prevents podman from joining the userns for machine
commands but the c shortcut code did not.

[NO TESTS NEEDED]

Fixes #11731

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-29 16:39:29 -04:00
Sankalp Rangare
5e9aa13dc0 added healthcheck to ps command
Signed-off-by: Sankalp Rangare <sankalprangare786@gmail.com>
2021-09-29 16:39:29 -04:00
Daniel J Walsh
0f87cfd288 podman generate kube should not include images command
If the command came from the underlying image, then we should
not include it in the generate yaml file.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-29 16:39:29 -04:00
Anders F Björklund
da67c71998 Also show the (initial) disk size
[NO TESTS NEEDED]

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2021-09-29 16:39:29 -04:00
Anders F Björklund
2c5382ba98 Show cpus and memory in machine list
[NO TESTS NEEDED]

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2021-09-29 16:39:29 -04:00
Brent Baude
d6f6767a59 Set context dir for play kube build
When performing an image build with play kube, we need to set the
context directory so things like file copies have the correct input
path.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-09-23 13:06:53 -05:00
Valentin Rothberg
f2c676e99a [3.4] podman save: enforce signature removal
Enforce the removal of signatures in `podman save` to restore behavior
prior to the migration to libimage.  We may consider improving on that
in the future.  For details, please refer to the excellent summary by
@mtrmac [1].

[NO TESTS NEEDED] - manually verified but exisiting tests need some
further investigation (see [1]).

[1] https://github.com/containers/podman/pull/11669#issuecomment-925250264

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-23 16:07:54 +02:00
OpenShift Merge Robot
c58a677f8e
Merge pull request #11705 from mheon/340
Release 3.4.0-rc2 (inc. backports)
2021-09-22 18:35:48 -04:00
Daniel J Walsh
72e19cf51e Generate kube should'd add podman default environment vars
Currently we add the default PATH, TERM and container from Podman
to every kubernetes.yaml file. These values should not be recorded
in the yaml files.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-09-22 16:49:15 -04:00
Matthew Heon
d45cbbda34 Add a backoff and retries to retrieving exited event
There's a potential race around extremely short-running
containers and events with journald. Events may not be written
for some time (small, but appreciable) after they are received,
and as such we can fail to retrieve it if there is a sufficiently
short time between us writing the event and trying to read it.

Work around this by just retrying, with a 0.25 second delay
between retries, up to 4 times.

[NO TESTS NEEDED] because I have no idea how to reproduce this
race in CI.

Fixes #11633

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-09-22 16:33:22 -04:00
Brent Baude
a98e0371ee Remove references to kube being development
At this point and even though we are always improving the play and
generate kube functions, I would say it no longers needs to be denoted
as under development.

[NO TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-09-22 16:32:33 -04:00
Paul Holzinger
863ea75c4f compat API: /images/json prefix image id with sha256
Docker adds the `sha256:` prefix to the image ID, so our compat endpoint
has to do this as well.

Fixes #11623

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-22 16:23:53 -04:00
Valentin Rothberg
7bfe9ca3da remote untag: support digests
Fix a bug when remotely untagging an image via tag@digest.
The digest has been lost in the remote client and hence led
to a wrong behaviour on the server.

Fixes: #11557
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-22 16:21:56 -04:00
Paul Holzinger
d27fcbdc21 container runlabel remove image tag from name
When no name is given for podman container runlabel it will default to
the image base name. However this can contain a tag. Since podman does
not accept container names with a colon the run command will fail if it
contains something like `podman run --name NAME ...`.

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

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-22 15:45:41 -04:00
Matej Vasek
1a25a90a4e Fix /auth compat endpoint
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-09-22 15:39:01 -04:00
Matej Vasek
c8fd65ea6a fix inverted condition
[NO TESTS NEEDED]

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-09-22 15:38:25 -04:00
Ashley Cui
3bd3c62134 Fix machine image
Make sure setting machine image to `testing` pulls down the testing
stream, and not the next stream

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-09-22 14:42:44 -04:00
Daniel J Walsh
f935008108
Merge pull request #11624 from giuseppe/3.4-fix-pause-process
[3.4] runtime: move pause process to scope
2021-09-20 14:17:56 -04:00
Valentin Rothberg
4406ebb461 [3.4] vendor c/common@v0.44.1
Finalizes the linked BZ to fix passing down custom authfiles during auto
updates.  Also fixes the if-newer pull policy.

[NO TESTS NEEDED] for now validated manually.  A new system test will be
added to the main branch shortly.

BZ: bugzilla.redhat.com/show_bug.cgi?id=2000943
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-20 13:29:14 +02:00
Giuseppe Scrivano
e6fe5d6312
system: move MovePauseProcessToScope to utils
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 72534a74b3)
2021-09-17 10:38:00 +02:00
Giuseppe Scrivano
ae5a5b51b0
system: always move pause process when running on systemd
when running on a systemd with systemd, always try to move the pause
process to its own scope.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 9c1e27fdd5)
2021-09-17 10:37:59 +02:00
Giuseppe Scrivano
34c9ce2ec9
system: avoid reading pause pid file
we already know the path to the pause PID file, no need to calculate
it again.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit fa9728c550)
2021-09-17 10:37:55 +02:00
Nalin Dahyabhai
e07dccc3ad build: take advantage of --platform lists
The builder can take a list of platforms in the Platforms field of its
BuildOptions argument, and we should definitely take advantage of that.

The `bud-multiple-platform-values` test from buildah exercises support
for this, so
[NO TESTS NEEDED]

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-09-16 11:00:05 -04:00
Jelle van der Waa
507000a304 api: handle nil pointer dereference in rest endpoints
When `?all=garbage` is passed to an API endpoint schema validation fails
and err is nil. Wrapf uses err to create an error message causing a nil
pointer dereference.

Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
2021-09-16 11:00:05 -04:00
Jelle van der Waa
c8cbd87fdc Document all query parameter for /libpod/images/prune
Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
2021-09-16 09:42:14 -04:00
Jhon Honce
74bc365eb6 Enhance bindings for IDE hints
* Follow https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source
  for leading comment
* Add godoc strings for all exposed methods for IDE support
* Copy field godoc strings into generated code as function godoc string
* Remove unused/unnecessary fields from generator.go structures
* Cleanup code regarding template usage

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-09-16 09:42:14 -04:00
Paul Holzinger
ffc8e57d3b remove rootlessport socket to prevent EADDRINUSE
When we restart a container via podman restart or restart policy the
rootlessport process fails with `address already in use` because the
socketfile still exists.
This is a regression and was introduced in commit abdedc31a2.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-16 09:42:14 -04:00
Hyeon Kim
33591c3ef4 Search gvproxy with config.FindHelperBinary()
Closes #11531

[NO TESTS NEEDED]

Signed-off-by: Hyeon Kim <simnalamburt@gmail.com>
2021-09-16 09:42:14 -04:00
Jason T. Greene
1af0f8934c Add deprecated fields for 1.22+ clients that still expect them
Signed-off-by: Jason Greene <jason.greene@redhat.com>
2021-09-16 09:42:14 -04:00
Ashley Cui
5829d62ea0 Use default username for podman machine ssh
When using the defaut conection for podman machine ssh, use the default
username too.

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-09-16 09:42:14 -04:00
baude
fceec6972f Use new aarch64 fcos repos
Now that aarch64 fcos is an official thing, we no longer need to use the side repo (for lack of a better word).  We can now use the same image lookup technique as x86_64.  I removed the special lookup, moved the x86_64 lookup to generic arch, and removed the arch specific files that we no longer needed.

[NO TESTS NEEDED]

Signed-off-by: baude <baude@redhat.com>
2021-09-15 07:43:12 -05:00