Commit graph

8488 commits

Author SHA1 Message Date
Matthew Heon
dd850ee08f Bump to v2.0.5-dev
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-31 15:54:30 -04:00
Matthew Heon
cab2786876
Bump to v2.0.4
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-31 15:53:41 -04:00
OpenShift Merge Robot
6422c5fcca
Merge pull request #7173 from mheon/204_relnotes_backports
[CI:DOCS] Update release notes for v2.0.4
2020-07-31 15:03:42 -04:00
Matthew Heon
8a8e639c8d Update release notes for v2.0.4
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-31 14:43:25 -04:00
OpenShift Merge Robot
87955d8541
Merge pull request #7170 from mheon/204_backports
Extra backports for v2.0.4
2020-07-31 14:06:37 -04:00
Matthew Heon
a9a55be991 Disable a nonfunctional build test
The amount of drift in the system tests on v2.0 is starting to
become difficult to deal with. 2.1.0 can't come soon enough.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-31 12:39:55 -04:00
Giuseppe Scrivano
2d71540518 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>

<MH: Fixed conflicts from cherry pick>

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-31 11:45:58 -04:00
Ashley Cui
2cc9af3692 add {{.RunningFor}} placeholder in ps --format
For docker compatibility

Signed-off-by: Ashley Cui <acui@redhat.com>
2020-07-31 11:44:53 -04:00
Paul Holzinger
994dc32942 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-31 11:44:16 -04:00
Matthew Heon
8e9724524d 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-31 11:43:40 -04:00
Daniel J Walsh
9b1a7894a1 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>

<MH: Fixed compile after cherry pick>

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-31 11:42:40 -04:00
Matthew Heon
da752a7ed3 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-31 11:41:05 -04:00
Daniel J Walsh
828b547491 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-31 11:40:25 -04:00
Anthony Sottile
e0774e65b4 add newline to output in error message
Signed-off-by: Anthony Sottile <asottile@umich.edu>
2020-07-31 11:39:17 -04:00
Daniel J Walsh
5d790bb2be When chowning we should not follow symbolic link
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-31 11:38:20 -04:00
Paul Holzinger
ae34c63860 replace the html/template package with text/template
Currently some commands use the html/template package.
This can lead to invalid output.
e.g. `system df --verbose` will print `&lt;none&gt;`
instead of `<none>` with an untaged image.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-07-31 11:37:22 -04:00
Matthew Heon
a34888de31 The podman start --attach command should not print ID
Somewhere in the Podman v2 rewrite, we allowed
`podman start --attach` to print the container ID of the started
container after exiting from the attach session (via detach key
or the container exiting naturally). We should never print the ID
when `--attach` is given, which makes the fix simple - make the
print statement conditional on `--attach` not being present.

Wierdly, this only happened with `--interactive` was given to
`podman start`. I don't know why that is, but this resolves the
issue without having to dig any deeper, so I'm content.

Fixes #7055

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-31 11:36:51 -04:00
Erik Sjölund
b75a79b981 Fix exit code example in podman-run.1.md
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2020-07-31 11:36:01 -04:00
OpenShift Merge Robot
b55a0ce42e
Merge pull request #7166 from vrothberg/2.0-backports
2.0 backports
2020-07-31 09:28:41 -04:00
Daniel J Walsh
c95d2856f8 Switch references from libpod.conf to containers.conf
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-31 13:01:47 +02:00
Akihiro Suda
806d0ab865 Bump github.com/rootless-containers/rootlesskit from 0.9.5 to 0.10.0
Fix #7016 via https://github.com/rootless-containers/rootlesskit/pull/157

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-07-31 13:01:47 +02:00
Akihiro Suda
cae3453316 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-31 13:01:47 +02:00
Daniel J Walsh
8c6a528693 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-31 13:01:45 +02:00
Ralf Haferkamp
6d7e508914 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-31 09:32:15 +02:00
OpenShift Merge Robot
eea6bd1cf4
Merge pull request #7089 from vrothberg/2.0-fix-7078
[2.0] events parsing fix #7078
2020-07-27 19:02:34 +02:00
Valentin Rothberg
e2cb457e5f test/apiv2: add a simple events test
Add a simple test to exercise the events API without the "filters"
parameter.  Prevents regressing on #7078.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-27 15:33:26 +02:00
Valentin Rothberg
1a1f9fac06 API events: fix parsing error
Fix an error where an absent "filters" parameter led to JSON parsing
errors.

Fixes: #7078
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-27 15:33:24 +02:00
OpenShift Merge Robot
9352c342d6
Merge pull request #7069 from mheon/bump_203
Bump to v2.0.3
2020-07-23 19:42:50 +02:00
Matthew Heon
d7d5068c6b Bump to v2.0.4-dev
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-23 12:37:26 -04:00
Matthew Heon
2349723f89
Bump to v2.0.3
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-23 12:36:20 -04:00
OpenShift Merge Robot
dade9159e7
Merge pull request #7054 from mheon/backports_203
Backports and Release Notes for v2.0.3
2020-07-23 11:04:48 +02:00
Matthew Heon
2faeb2189f Drop a nonfunctional test in test/apiv2
I'm somewhat reluctant to do this, but the file has diverged
majorly from master, and the amount of stuff we've backported
(versus not backported) makes me very hesitant to try cherry
picking more from master in the hope that it will start working.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-22 16:34:39 -04:00
Matthew Heon
b2e0a03371 Update release notes for v2.0.3
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-22 14:54:54 -04:00
Daniel J Walsh
4d7626cc89 Fix handling of entrypoint
If a user specifies an entrypoint of "" then we should not use the images
entrypoint.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-22 14:53:26 -04:00
Valentin Rothberg
84076bf95f log API: add context to allow for cancelling
Add a `context.Context` to the log APIs to allow for cancelling
streaming (e.g., via `podman logs -f`).  This fixes issues for
the remote API where some go routines of the server will continue
writing and produce nothing but heat and waste CPU cycles.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-22 14:50:47 -04:00
zhangguanzhang
f9526cf02b fix API: Create container with an invalid configuration
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-07-22 14:48:01 -04:00
Matthew Heon
f9eb204d0d Remove all instances of named return "err" from Libpod
This was inspired by https://github.com/cri-o/cri-o/pull/3934 and
much of the logic for it is contained there. However, in brief,
a named return called "err" can cause lots of code confusion and
encourages using the wrong err variable in defer statements,
which can make them work incorrectly. Using a separate name which
is not used elsewhere makes it very clear what the defer should
be doing.

As part of this, remove a large number of named returns that were
not used anywhere. Most of them were once needed, but are no
longer necessary after previous refactors (but were accidentally
retained).

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-22 14:47:03 -04:00
Korhonen Sami (Samlink)
79b005e638 Fix: Correct connection counters for hijacked connections
This patch fixes connection counters for v2 endpoints

Idletracker was moved to a new package to prevent package cycle.
Hijacking code still remains in wrong place and should be moved
later to isolated package

Signed-off-by: Sami Korhonen <skorhone@gmail.com>
2020-07-22 14:46:40 -04:00
Korhonen Sami (Samlink)
7759c8c9f3 Fix: Hijacking v2 endpoints to follow rfc 7230 semantics
After this patch v2 hijacking endpoints, exec/start and
containers/attach follow rfc 7230 specification.

Connection will only be upgraded, if client specifies upgrade
headers:

For tcp connections:

Connection: Upgrade
Upgrade: tcp

For unix socket connections:

Connection: Upgrade
Upgrade: sock

There are currently no checks if upgrade type actually matches with
available protocols. Implementation just protocol that client
requested

Signed-off-by: Sami Korhonen <skorhone@gmail.com>
2020-07-22 14:46:31 -04:00
Korhonen Sami (Samlink)
6128cbec04 Remove hijacked connections from active connections list
StateHijacked is a terminal state. If hijacked connection
is registered as an active connection, connection will
never be unregistered. This causes two issues

First issue is that active connection counters are off.

Second issue is a resource leak caused by connection
object that is stored to a map.

After this patch hijacked connections are no longer
visible in counters. If a counter for hijacked
connections is required, podman must track
connections returned by Hijacker.Hijack()

It might make sense to develop abstraction layer for
hijacking - and move all hijacking related code to a
separate package. Hijacking code is prone to resource
leaks and it should be thoroughly tested.

Signed-off-by: Sami Korhonen <skorhone@gmail.com>
2020-07-22 14:45:28 -04:00
Valentin Rothberg
1fb32b9b2f version/info: format: allow more json variants
Allow more variants to yield json output for `podman version` and
`podman info`.  Instead of comparing strings, use a regex and add
unit and e2e tests.

Fixes: #6927
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-22 14:42:53 -04:00
Matthew Heon
ce829a2a84 Correctly print STDOUT on non-terminal remote exec
I confused STDIN and STDOUT's file descriptors (it's 0 and 1, I
thought they were 1 and 0). As such, we were looking at whether
we wanted to print STDIN when we looked to print STDOUT. This
bool was set when `-i` was set in at the `podman exec` command
line, which masked the problem when it was set.

Fixes #6890
Fixes #6891
Fixes #6892

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-22 14:41:17 -04:00
Matthew Heon
0630d19b34 Fix container and pod create commands for remote create
In `podman inspect` output for containers and pods, we include
the command that was used to create the container. This is also
used by `podman generate systemd --new` to generate unit files.

With remote podman, the generated create commands were incorrect
since we sourced directly from os.Args on the server side, which
was guaranteed to be `podman system service` (or some variant
thereof). The solution is to pass the command along in the
Specgen or PodSpecgen, where we can source it from the client's
os.Args.

This will still be VERY iffy for mixed local/remote use (doing a
`podman --remote run ...` on a remote client then a
`podman generate systemd --new` on the server on the same
container will not work, because the `--remote` flag will slip
in) but at the very least the output of `podman inspect` will be
correct. We can look into properly handling `--remote` (parsing
it out would be a little iffy) in a future PR.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>

<MH: Fixed build after cherry-pick>

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-22 14:39:41 -04:00
Daniel J Walsh
800595a0a3 Mask out /sys/dev to prevent information leak from the host
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-22 14:35:30 -04:00
Matthew Heon
0030dd3f75 Ensure sig-proxy default is propagated in start
We properly determined what sig-proxy should be set to, but we
never passed that along to the backend. As such, cases where the
default swapped (mostly when `--attach` was specified but the
`--sig-proxy` flag was not) were not handled correctly

Fixes #6928

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-22 14:34:20 -04:00
Matthew Heon
24f0175d90 Add SystemdMode to inspect for containers
This allows us to determine if the container auto-detected that
systemd was in use, and correctly activated systemd integration.
Use this to wire up some integration tests to verify that systemd
integration is working properly.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>

<MH: Fixed Compile after cherry-pick>

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-22 14:31:26 -04:00
Matthew Heon
db81bc2c83 When determining systemd mode, use full command
We were only using the Command field in specgen when determining
whether to enable systemd if systemd=true (the default) was used.
This does not include the entrypoint, and does not include any
entrypoint/command sourced from the image - so an image could be
running systemd and we'd not correctly detect this. Using the
full, final command resolves this and matches Podman v1.9.x
behavior.

Fixes #6920

Signed-off-by: Matthew Heon <matthew.heon@pm.me>

<MH: Fixed compile after backport>

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-22 14:28:42 -04:00
Matthew Heon
f74a28e08a Fix lint
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-22 14:20:14 -04:00
Matthew Heon
cad36d4b7a Populate remaining unused fields in pod inspect
We were hard-coding two fields to false, instead of grabbing
their value from the pod config, which means that `pod inspect`
would print the wrong value always.

Fixes #6968

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-22 14:20:00 -04:00
Matthew Heon
31ecb728d2 Include infra container information in pod inspect
We had a field for this in the inspect data, but it was never
being populated. Because of this, `podman pod inspect` stopped
showing port bindings (and other infra container settings). Add
code to populate the infra container inspect data, and add a test
to ensure we don't regress again.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-22 14:19:50 -04:00