1851 Commits

Author SHA1 Message Date
c2a0ccd394 Merge pull request #6747 from giuseppe/fix-user-volumes
container: move volume chown after spec generation
2020-06-30 12:01:40 -04:00
aa69e68ef7 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-06-30 11:25:13 +10:00
e0b93af70f Merge pull request #6808 from mheon/allow_empty_hostport
Allow empty host port in --publish flag
2020-06-29 13:52:47 -04:00
b32172e20b 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-06-29 17:58:50 +02:00
dfb2f92583 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>
2020-06-29 09:17:55 -05:00
3601b96600 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-06-29 09:33:43 -04:00
cbae41f75f Merge pull request #6763 from maxm123/master
Fix error handling problem in APIv2 network remove
2020-06-29 04:59:34 -04:00
3022d70285 Merge pull request #6768 from vrothberg/fix-6766
generate systemd: improve pod-flags filter
2020-06-29 04:56:31 -04:00
babc64b44b 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-06-27 15:02:55 +02:00
f0ca17650e 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-06-26 10:07:20 -04:00
43c19966f6 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 76f8efc0d0d into specgen

Signed-off-by: Ralf Haferkamp <rhafer@suse.com>
2020-06-26 11:17:32 +02:00
bb11b42879 Merge pull request #6756 from mheon/add_dangling_filter
Add support for dangling filter to volumes
2020-06-26 05:11:50 -04:00
358e69cc2d Merge pull request #6761 from mheon/fix_ps_portmappings
Print port mappings in `ps` for ctrs sharing network
2020-06-25 13:22:36 -04:00
4daf82bd96 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 12:00:17 +02:00
2fed50f431 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-06-25 10:13:58 +02:00
35cca198b3 Merge pull request #6713 from mheon/debug_level
Set syslog for exit commands on log-level=debug
2020-06-25 03:11:03 -04:00
16b3356a89 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-24 17:27:26 -04:00
d78e83f47d Add support for dangling filter to volumes
The dangling filter determine whether a volume is dangling - IE,
it has no containers attached using it. Unlike our other filters,
this one is a boolean - must be true or false, not arbitrary
values.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-24 15:12:56 -04:00
18300573f9 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-24 13:09:34 -04:00
061261ee05 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 18:13:42 +02:00
c07df63c45 Merge pull request #6741 from maybe-sybr/maybe/apiv2/fix-volume-create-code
APIv2: Return `StatusCreated` from volume creation
2020-06-24 09:32:39 -04:00
179731bb14 Merge pull request #6738 from maybe-sybr/maybe/apiv2/fix-network-compat-urls
APIv2:fix: Remove `/json` from compat network EPs
2020-06-24 09:29:53 -04:00
b74238864f Merge pull request #6739 from jwhonce/wip/connection
Fix ssh-agent support
2020-06-24 09:24:24 -04:00
3430ca4df0 APIv2: Return StatusCreated from volume creation
The swagdoc in `register_volumes.go` already correctly notes that a 201
should be returned upon success, so we only need to change the handler
to match the spec.

Signed-off-by: Matt Brindley <58414429+maybe-sybr@users.noreply.github.com>
2020-06-24 15:08:20 +10:00
5fbac502bd APIv2:fix: Remove /json from compat network EPs
Signed-off-by: Matt Brindley <58414429+maybe-sybr@users.noreply.github.com>
2020-06-24 12:20:49 +10:00
4e59fd77a8 Fix ssh-agent support
* An identity of "" implies ssh-agent and user/password to be used
* Fixed example

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-06-23 18:51:56 -07:00
bfcfdfcb74 APIv2:doc: Fix swagger doc to refer to volumes
Signed-off-by: Matt Brindley <58414429+maybe-sybr@users.noreply.github.com>
2020-06-24 11:37:00 +10:00
aa6881dd14 Merge pull request #6731 from baude/toolboxjson
Add JSON output field for ps
2020-06-23 14:14:43 -04:00
9ec0e10484 Add JSON output field for ps
the toolbox team needs a field in our ps json that represents a human readable time.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-06-23 11:24:27 -05:00
7377e578a9 V2 podman system connection
* Implement command
* Refactor podman-remote to pull from containers.conf by default
* podman-remote defaults to --remote being true
* Write podman-system-connection.1.md

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-06-23 08:18:53 -07:00
3c51ff92ca Merge pull request #6710 from vrothberg/fix-6413
libpod/containers/json: alias last -> limit
2020-06-23 12:16:15 +02:00
9e37fd43e4 Merge pull request #6625 from QiWang19/fd
Add --preservefds to podman run
2020-06-23 10:00:21 +02:00
13cfdb0742 Fix conflicts between privileged and other flags
The `--privileged` flag does not conflict with `--group-add`
(this one was breaking Toolbox) and does not conflict with most
parts of `--security-opt` (this was breaking Openstack).

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-22 16:08:09 -04:00
2abcd4f1de libpod/containers/json: alias last -> limit
Support both `last` and `limit` for in the containers listing endpoint.
We intended to use `limit` which is also mentioned in the docs, but the
implementation ended up using `last` as the http parameter; likely being
caused by the CLI using `--last`.  To avoid any regression, we decided
for supporting both and aliasing `last`.

Fixes: #6413
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-22 16:55:48 +02:00
11e237bc3a rootless_linux: improve error message
Improve the error message for rootless mode.

Git-Url: https://github.com/containers/libpod/issues/6572
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
2020-06-21 06:35:25 -04:00
f403aa3baa Merge pull request #6621 from vrothberg/bz-1846629
search: allow wildcards
2020-06-20 05:57:25 -04:00
21f3bdf63d Merge pull request #6675 from yhchen0906/master
correct the absolute path of `rm` executable
2020-06-20 05:49:06 -04:00
bda4a6982f Correct logic for demux'ing channels
* Move check for requesting output into case statement

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-06-19 08:35:15 -07:00
f18d2751f6 correct the absolute path of rm executable
Signed-off-by: Yuan-Hao Chen <yhchen0906@gmail.com>
2020-06-19 22:23:35 +08:00
f61a7f25a8 Add --preservefds to podman run
Add --preservefds to podman run. close https://github.com/containers/libpod/issues/6458

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-06-19 09:40:13 -04:00
b05888a97d search: allow wildcards
Allow wildcards in the search term.  Note that not all registries
support wildcards and it may only work with v1 registries.

Note that searching implies figuring out if the specified search term
includes a registry.  If there's not registry detected, the search term
will be used against all configured "unqualified-serach-registries" in
the registries.conf.  The parsing logic considers a registry to be the
substring before the first slash `/`.

With these changes we now not only support wildcards but arbitrary
input; ultimately it's up to the registries to decide whether they
support given input or not.

Fixes: bugzilla.redhat.com/show_bug.cgi?id=1846629
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-19 14:47:36 +02:00
b20619e5b0 Allow recursive dependency start with Init()
As part of APIv2 Attach, we need to be able to attach to freshly
created containers (in ContainerStateConfigured). This isn't
something Libpod is interested in supporting, so we use Init() to
get the container into ContainerStateCreated, in which attach is
possible. Problem: Init() will fail if dependencies are not
started, so a fresh container in a fresh pod will fail. The
simplest solution is to extend the existing recursive start code
from Start() to Init(), allowing dependency containers to be
started when we initialize the container (optionally, controlled
via bool).

Also, update some comments in container_api.go to make it more
clear how some of our major API calls work.

Fixes #6646

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-06-18 09:34:04 -04:00
6472b44c34 Merge pull request #6654 from rhatdan/keepid
Don't ignore --user flag in rootless --userns keepid
2020-06-17 21:22:06 -04:00
fe69aa9ba3 Handle dropping capabilties correctly when running as non root user
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-17 17:20:53 -04:00
c385e6d363 Don't ignore --user flag in rootless --userns keepid
Currently podman run --userns keep-id --user root:root fedora id

The --user flag is ignored.  Removing this makes the code work correctly.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-17 17:13:58 -04:00
a76bf114d1 Merge pull request #6620 from jgallucci32/api-logs-separate
Move logs functionality to separate file for APIv2
2020-06-17 15:50:05 -04:00
70f6cf7ffa Merge pull request #6634 from baude/v2buildfixes
fix misc remote build issues
2020-06-17 15:36:02 -04:00
fd184fa4a1 Merge pull request #6522 from mheon/unless-stopped
Add support for the unless-stopped restart policy
2020-06-17 15:25:09 -04:00
585b14a9f8 Move logs functionality to separate file for APIv2
This simply moves the function for the log handler for
APIv2 to a separate file to be consistent with other parts
of the code base.

Signed-off-by: jgallucci32 <john.gallucci.iv@gmail.com>
2020-06-17 11:48:53 -07:00
d97b5b04aa Merge pull request #6630 from ashley-cui/master
Show Anon, GID, UID in v2 volumes
2020-06-17 20:25:18 +02:00