Commit graph

8389 commits

Author SHA1 Message Date
Matthew Heon
2fb9bb20df Fix imports to ensure v2 is used with libpod
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-06 14:44:40 -04:00
Matthew Heon
a67526d9f2 Update release notes for v2.0.2
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-06 14:25:39 -04:00
Ralf Haferkamp
626aeffc55 specgen: fix order for setting rlimits
Also make sure that the limits we set for rootless are not higher than
what we'd set for root containers.

Rootless containers failed to start when the calling user already
had ulimit (e.g. on NOFILE) set.

This is basically a cherry-pick of 76f8efc0d0 into specgen

Signed-off-by: Ralf Haferkamp <rhafer@suse.com>
2020-07-06 14:21:53 -04:00
Matthew Heon
0b7885b90a Ensure umask is set appropriately for 'system service'
We need a umask of 0022 to ensure containers are created
correctly, but we set a different one prior to starting the
server (to ensure the unix socket has the right permissions).
Thus, we need to set the umask after the socket has been bound,
but before the server begins accepting requests.

Fixes #6787

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-06 14:21:17 -04:00
Valentin Rothberg
8643526953 generate systemd: improve pod-flags filter
When generating systemd unit for pods, we need to remove certain
pod-related flags from the containers' create commands.  Make sure
to account for all the syntax including a single argument with key and
value being split by `=`.

Fixes: #6766
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-06 14:18:20 -04:00
Maximilian Müller
1444be3d53 Fix a bug with APIv2 compat network remove to log an ErrNetworkNotFound instead of nil
Signed-off-by: Maximilian Müller <maxm123@techie.com>
2020-07-06 14:16:39 -04:00
Jhon Honce
8dd26289bf Fixes --remote flag issues
* --remote, --url and --identity are now anchored to podman command.
  Subcommands should no longer have issues
* TraverseChildren now set to V1 expectations
* Latest flag now has helper function. Now has consistent usage.
* IsRemote() uses cobra parser to determin if --remote is given
* Moved validation functions from parser pkg to validate pkg
*

Fixes #6598
Fixes #6704

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

<MH: Fixed import issues>

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2020-07-06 14:14:53 -04:00
Brent Baude
de6a8609a8 Set console mode for windows
Windows terminal handling is different than darwin and linux.  It needs to have the terminal mode set to enable virtual terminal processing.  This allows colors and other things to work.

Signed-off-by: Brent Baude <bbaude@redhat.com>

<MH: Tweaked imports to compile>

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2020-07-06 13:41:39 -04:00
Matthew Heon
1c02d5ab89 Allow empty host port in --publish flag
I didn't believe that this was actually legal, but it looks like
it is. And, unlike our previous understanding (host port being
empty means just use container port), empty host port actually
carries the same meaning as `--expose` + `--publish-all` (that
is, assign a random host port to the given container port). This
requires a significant rework of our port handling code to handle
this new case. I don't foresee this being commonly used, so I
optimized having a fixed port number as fast path, which this
random assignment code running after the main port handling code
only if necessary.

Fixes #6806

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-06 13:37:27 -04:00
Matthew Heon
56c873c14e Add a note on the APIs supported by system service
This makes it clear that we target compatibility with a specific
Docker version (v1.40), but do not reject other versions. It also
adds a link to documentation on the Podman-specific API.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-06 13:36:59 -04:00
maybe-sybr
042675b9b3 fix: Don't override entrypoint if it's nil
This change ensures that we only override a container's entrypoint if it
is set to something other than `nil`.

Signed-off-by: Matt Brindley <58414429+maybe-sybr@users.noreply.github.com>
2020-07-06 13:36:00 -04:00
Daniel J Walsh
0c4a734353 Set TMPDIR to /var/tmp by default if not set
Containers/image will use TMPDIR for the location of pulled layer blobs.
If TMPDIR is not set, it will use /tmp.  Since this is known to be of
limited space on most systems, we change the default to /var/tmp
if the user has not told the tools where to store temporary files.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-06 13:35:33 -04:00
Valentin Rothberg
3405e4fb68 test: add tests for --user and volumes
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-06 13:31:28 -04:00
Giuseppe Scrivano
eb85f42907 container: move volume chown after spec generation
move the chown for newly created volumes after the spec generation so
the correct UID/GID are known.

Closes: https://github.com/containers/libpod/issues/5698

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-06 13:31:21 -04:00
Giuseppe Scrivano
f5b368400c libpod: volume copyup honors namespace mappings
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-06 13:31:13 -04:00
Matthew Heon
4995c511e5 Fix system service panic from early hangup in events
We weren't actually halting the goroutine that sent events, so it
would continue sending even when the channel closed (the most
notable cause being early hangup - e.g. Control-c on a curl
session). Use a context to cancel the events goroutine and stop
sending events.

Fixes #6805

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-06 13:14:31 -04:00
Brent Baude
637ff7b7e9 stop podman service in e2e tests
when running e2e tests, each test knows to stop its service when running remote; however, during setup and teardown remote services were not being killed when we were done with them.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-07-06 13:13:10 -04:00
Matthew Heon
06b5a8c2f7 Print errors from individual containers in pods
The infra/abi code for pods was written in a flawed way, assuming
that the map[string]error containing individual container errors
was only set when the global error for the pod function was nil;
that is not accurate, and we are actually *guaranteed* to set the
global error when any individual container errors. Thus, we'd
never actually include individual container errors, because the
infra code assumed that err being set meant everything failed and
no container operations were attempted.

We were originally setting the cause of the error to something
nonsensical ("container already exists"), so I made a new error
indicating that some containers in the pod failed. We can then
ignore that error when building the report on the pod operation
and actually return errors from individual containers.

Unfortunately, this exposed another weakness of the infra code,
which was discarding the container IDs. Errors from individual
containers are not guaranteed to identify which container they
came from, hence the use of map[string]error in the Pod API
functions. Rather than restructuring the structs we return from
pkg/infra, I just wrapped the returned errors with a message
including the ID of the container.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-06 13:10:13 -04:00
Valentin Rothberg
d59ef41194 auto-update: clarify systemd-unit requirements
Clarify in the help message and the man page that auto updates only work
with systemd units that are similar to the ones from `generate systemd
--new`.  Units that merely start/stop a container do not work as they
will use the same image.

Fixes: #6793
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-06 13:08:56 -04:00
Paul Holzinger
0e547a4cc3 podman ps truncate the command
With a long create command the
output from ps is basically unreadable.

This is a regression that was introduced with Podman 2.0.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-07-06 13:07:29 -04:00
OpenShift Merge Robot
1a60550bef
Merge pull request #6865 from vrothberg/2.0-v2-module
[2.0] move go module to v2
2020-07-06 11:20:41 -04:00
Valentin Rothberg
2d74811520 move go module to v2
With the advent of Podman 2.0.0 we crossed the magical barrier of go
modules. While we were able to continue importing all packages inside
of the project, the project could not be vendored anymore from the
outside.

Move the go module to new major version and change all imports to
github.com/containers/libpod/v2. The renaming of the imports
was done via gomove [1].

[1] https://github.com/KSubedi/gomove

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-06 15:52:17 +02:00
OpenShift Merge Robot
aa4ec20c0f
Merge pull request #6860 from rhatdan/v2.0
Vendor containers/common v0.14.4
2020-07-06 09:49:24 -04:00
Daniel J Walsh
5f9e7b5355
Vendor containers/common v0.14.4
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-06 06:49:21 -04:00
OpenShift Merge Robot
1ba8c23587
Merge pull request #6849 from TomSweeneyRedHat/dev/tsweeney/ib_v1.1.6_v2
Bump to imagebuilder v1.1.6 on v2 branch
2020-07-06 06:21:04 -04:00
TomSweeneyRedHat
d4a0337d02 Bump to imagebuilder v1.1.6 on v2 branch
As the title says.

Addresses: https://github.com/containers/buildah/issues/2424

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2020-07-02 15:27:54 -04:00
OpenShift Merge Robot
1e42970417
Merge pull request #6802 from lsm5/v2.0-registry-port-number
Account for non-default port number in image name (backported from master)
2020-06-29 04:43:19 -04:00
Lokesh Mandvekar
9eebfd40ae Account for non-default port number in image name
Previously, if an image was tagged with the format
$REGISTRY:$PORT/$REPO:$TAG,
then `podman images` would display $PORT/$REPO:$TAG under the "TAG"
field.

This commit correctly displays $REGISTRY:$PORT/$REPO under the
"REPOSITORY" field while the "TAG" field only displays $TAG.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>

Fixes: gh#6665
(cherry picked from commit 71f6dd47dd)
2020-06-27 14:05:00 -04:00
OpenShift Merge Robot
9f8472afc9
Merge pull request #6792 from baude/2.0swagger
[CI:DOCS]Add swagger.yaml to docs/
2020-06-26 11:24:26 -04:00
Brent Baude
00b1c4b6b3 [CI:DOCS]Add swagger.yaml to docs/
Adding the swagger.yaml to the docs directory so that we can version the read-the-docs API information. also, change the links to be relative in nature and point to the new swagger.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-06-26 09:58:14 -05:00
OpenShift Merge Robot
f9cb0dff1a
Merge pull request #6782 from mheon/bump_201
[CI:DOCS] Bump to v2.0.1
2020-06-25 17:37:13 -04:00
Matthew Heon
93303f11bc Bump to v2.0.2-dev
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-06-25 17:13:21 -04:00
Matthew Heon
a11c4ead10
Bump to v2.0.1
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-06-25 17:12:43 -04:00
OpenShift Merge Robot
6a541f6802
Merge pull request #6780 from mheon/even_more_201_backports
Even more v2.0.1 backports
2020-06-25 17:05:26 -04:00
Matthew Heon
f7b16d0173 Update release notes with further v2.0.1 changes
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-06-25 15:48:57 -04:00
Daniel J Walsh
8bb986137b Fix inspect to display multiple label: changes
If the user runs a container like

podman run --security-opt seccomp=unconfined --security-opt label=type:spc_t --security-opt label=level:s0 ...

Podman inspect was only showing the second option

This change will show

            "SecurityOpt": [
                "label=type:spc_t,label=level:s0:c60",
                "seccomp=unconfined"
            ],

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-25 15:42:42 -04:00
Matthew Heon
2ad9dcc07e Set syslog for exit commands on log-level=debug
We have a flag, --syslog, for telling logrus to log to syslog as
well as to the terminal. Previously, this flag also set the exit
command for containers to use `--syslog` (otherwise all output
from exit commands is lost). I attempted to replicate this with
Podman v2.0, but quickly ran into circular import hell (the flag
is defined in cmd/podman, I needed it in cmd/podman/containers,
cmd/podman imports cmd/podman/containers already, etc). Instead,
let's just set the syslog flag automatically on
`--log-level=debug` so we log exit commands automatically when
debug-level logs are requested. This is consistent with Conmon
and seems to make sense.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-25 15:42:32 -04:00
Ed Santiago
723a9e308f Friendly amendment for pr 6751
More robust system test for podman run/create docker-archive

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-25 15:41:21 -04:00
Valentin Rothberg
68543bbece podman run/create: support all transports
Support all image transports in podman run/create.  It seems we
regressed with v2 on that.  Also add tests to make sure we're
not regressing again.

Fixes: #6744
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-25 15:41:13 -04:00
Valentin Rothberg
c69ce171aa systemd generate: allow manual restart of container units in pods
Allow manual restarts of container units that are part of a pod.
This allows for configuring these containers for auto updates.

Fixes: #6770
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-25 15:38:22 -04:00
Jhon Honce
9de1581e93 Revert sending --remote flag to containers
* quick --remote fix, sent --remote to ctnrs as argument

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-06-25 15:37:26 -04:00
Matthew Heon
dc22350be5 Print port mappings in ps for ctrs sharing network
In Podman v1.9, we printed port mappings for the container, even
if it shared its network namespace (and thus ports) with another
container. We regressed on this in Podman v2.0, which is fixed
here.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-25 15:35:58 -04:00
OpenShift Merge Robot
48ce67fb56
Merge pull request #6776 from vrothberg/2.0-vendor-common
[2.0] vendor github.com/containers/common@v0.14.3
2020-06-25 14:30:23 -04:00
Valentin Rothberg
6eefff6471 vendor github.com/containers/common@v0.14.3
Includes several fixes for config parsing and AppArmor.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-25 18:00:28 +02:00
OpenShift Merge Robot
0b9143df88
Merge pull request #6758 from mheon/v2.0.1_backports
V2.0.1 backports
2020-06-24 16:25:41 -04:00
Matthew Heon
915f8698f4 Update release notes for v2.0.1
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-06-24 15:09:31 -04:00
Giuseppe Scrivano
8e428fa4e6 utils: drop default mapping when running uid!=0
this is a leftover from the first implementation of rootless.  This
code is never hit by podman rootless anymore as podman automatically
creates a user namespace now.

Fixes an issue with podman remote when used with uid != 0.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-06-24 14:48:14 -04:00
Matthew Heon
eb9fd40d21 Set stop signal to 15 when not explicitly set
When going through the output of `podman inspect` to try and
identify another issue, I noticed that Podman 2.0 was setting
StopSignal to 0 on containers by default. After chasing it
through the command line and SpecGen, I determined that we were
actually not setting a default in Libpod, which is strange
because I swear we used to do that. I re-added the disappeared
default and now all is well again.

Also, while I was looking for the bug in SpecGen, I found a bunch
of TODOs that have already been done. Eliminate the comments for
these.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-24 14:47:59 -04:00
Valentin Rothberg
6594d5d655 podman untag: error if tag doesn't exist
Throw an error if a specified tag does not exist.  Also make sure that
the user input is normalized as we already do for `podman tag`.

To prevent regressions, add a set of end-to-end and systemd tests.

Last but not least, update the docs and add bash completions.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-24 14:46:50 -04:00
Qi Wang
639b809c80 Reformat inspect network settings
Reformat ports of inspect network settings to compatible with docker inspect. Close #5380

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-06-24 14:46:32 -04:00