9625 Commits

Author SHA1 Message Date
d72918fe6f Podman build should default to not usins stdin
Currently we leak stdin into podman builds, which can lead
to issues like run commands inside of the container waiting for
user input.

We should not take input from users other then if the user specifies
podman build -f - or podman build -, which are taken care of in other code.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-21 05:33:00 -04:00
94873a237a Merge pull request #8075 from mheon/fix_8073
Retrieve network inspect info from dependency container
2020-10-20 17:07:11 -04:00
4822cc8cab Merge pull request #8042 from rhatdan/tlsverify
--tls-verify and --authfile should work for all remote commands
2020-10-20 15:34:56 -04:00
6961b9475d Merge pull request #8067 from mheon/net_host_hosts
Ensure that hostname is added to hosts with net=host
2020-10-20 15:18:53 -04:00
c1b844ecc8 Retrieve network inspect info from dependency container
When a container either joins a pod that shares the network
namespace or uses `--net=container:` to share the network
namespace of another container, it does not have its own copy of
the CNI results used to generate `podman inspect` output. As
such, to inspect these containers, we should be going to the
container we share the namespace with for network info.

Fixes #8073

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-10-20 13:27:33 -04:00
36682115b0 Merge pull request #7126 from mheon/fix_missing_ociruntime
Fix missing OCI Runtime
2020-10-20 11:22:43 -04:00
6c0b600e7d Merge pull request #7999 from mheon/signal_handler
Add a shutdown signal handler
2020-10-20 11:16:11 -04:00
1b288a35ba Ensure that hostname is added to hosts with net=host
When a container uses --net=host the default hostname is set to
the host's hostname. However, we were not creating any entries
in `/etc/hosts` despite having a hostname, which is incorrect.
This hostname, for Docker compat, will always be the hostname of
the host system, not the container, and will be assigned to IP
127.0.1.1 (not the standard localhost address).

Also, when `--hostname` and `--net=host` are both passed, still
use the hostname from `--hostname`, not the host's hostname (we
still use the host's hostname by default in this case if the
`--hostname` flag is not passed).

Fixes #8054

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-10-20 10:31:15 -04:00
1b4933376f Add a system test to verify --runtime is preserved
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-10-20 09:24:32 -04:00
3858fc1d01 Use runtime names instead of paths in E2E tests
My patches to fix `--runtime /usr/bin/crun` being allowed to use
a different version of the crun runtime revealed a problem: we
were actually relying on that exact behavior in our E2E tests. We
specified the runtime path as `/usr/bin/runc` for the Ubuntu
tests, but that didn't exist, so Podman was actively looking for
a different, usable runc binary and using that, instead of the
path we explicitly hardcoded. Fixing the bug broke this, and thus
broke the tests.

Instead of hard-coding OCI runtime paths, swap to just using the
runtime name, `runc` or `crun`, and letting Podman figure out
where the runtime lives - it's quite good at that. This should
un-break the tests and make them more durable.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-10-20 09:20:33 -04:00
338d521782 Re-create OCI runtimes by path when it is missing
When an OCI runtime is given by full path, we need to ensure we
use the same runtime on subsequent use. Unfortunately, users are
often not considerate enough to use the same `--runtime` flag
every time they invoke runtime - and if the runtime was not in
containers.conf, that means we don't have it stored inn the
libpod Runtime.

Fortunately, since we have the full path, we can initialize the
OCI runtime for use at the point where we pull the container from
the database.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-10-20 09:20:33 -04:00
f9655d92d6 When given OCI runtime by path, use path as name
Say I start a container with the flag
`--runtime /usr/local/sbin/crun`. I then stop the container, and
restart it without the flag. We previously stored the runtime in
use by a container only by basename when given a path, so the
container only knows that it's using the `crun` OCI runtime - and
on being restarted without the flag, it will use the system crun,
not my special crun build.

Using the full path as the name in these cases ensures we will
still use the correct runtime, even on subsequent runs of Podman.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-10-20 09:20:33 -04:00
35b4cb1965 Merge pull request #8069 from matejvasek/fix-memswap
fix: neutral value for MemorySwappiness
2020-10-20 07:33:13 -04:00
cec0e57497 Merge pull request #8043 from saschagrunert/hostport-fix
Fix host to container port mapping for simple ranges
2020-10-20 07:29:46 -04:00
f9450300b7 Merge pull request #8061 from edsantiago/bats
System tests: remove some misleading 'run's
2020-10-20 07:25:35 -04:00
bacdbf6e20 fix: neutral value for MemorySwappiness
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-10-20 03:13:56 +02:00
e944544271 Merge pull request #8056 from xordspar0/invalid-image
Make invalid image name error more specific
2020-10-19 15:49:11 -04:00
8cbf7700a5 Make invalid image name error more specific
Previously, using an invalid image name would produce an error like
this:

    Error: error encountered while bringing up pod test-pod-0: invalid reference format

This message didn't specify that there was an problem with an image
name, and it didn't specify which image name had a problem if there were
multiple. Now the error reads:

    Error: error encountered while bringing up pod test-pod-0: Failed to parse image "./myimage": invalid reference format

Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
2020-10-19 10:06:17 -05:00
b23d430516 System tests: remove some misleading 'run's
The BATS 'run' directive is really quite obnoxious; for the
most part we really don't want to use it. Remove some uses
that snuck in last week, and remove one test (exists) that
can more naturally be piggybacked into an rm test.

While we're at it: in setup(), look for and delete stray
external (buildah) containers. This will be important if
any of the external-container tests fails; this way we
don't leave behind a state that causes subsequent tests
to fail.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-10-19 08:43:56 -06:00
3d2ad0f97a --tls-verify and --authfile should work for all remote commands
These options are now fully supported in the remote API and should no
longer be hidden and/or documented as non supported.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-19 05:55:11 -04:00
49424fc02a Fix host to container port mapping for simple ranges
This fixes the issue that a simple port range should map to a random
port range from the host to the container, if no host port range is
specified. For example this fails without applying the patch:

```
> podman run -it -p 6000-6066 alpine
Error: cannot listen on the TCP port: listen tcp4 :53: bind: address already in use
```

The issue is that only the first port is randomly chosen and all
following in the range start by 0 and increment. This is now fixed by
tracking the ranges and then incrementing the random port if necessary.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-10-19 11:19:12 +02:00
7ffcab0854 Merge pull request #7908 from rhatdan/diff
fix podman container exists and diff for storage containers
2020-10-19 02:49:27 -04:00
6ec96dc009 Merge pull request #8044 from Luap99/fix-8040
Always add the dnsname plugin to the config for rootless
2020-10-18 04:37:13 -04:00
0fd5437904 Always add the dnsname plugin to the config for rootless
The rootless-cni-infra container always has the dnsname
plugin installed. It makes no sense to check if it is
present on the host.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-10-17 15:25:58 +02:00
39f1bea46d Merge pull request #8045 from andylibrian/podman-remote-cleanly-exit-on-detachkeyspressed
Update podman-remote run and start to handle detach keys
2020-10-17 07:18:37 -04:00
28d331d074 Merge pull request #8036 from xordspar0/heading-consistency
[CI:DOCS] Make man page headings more consistent
2020-10-16 17:58:54 -04:00
9d5f28ba9e Merge pull request #8039 from zhangguanzhang/runlabel-panic
Fix panic when runlabel is missing
2020-10-16 16:10:02 -04:00
88bc133dac Make man page headings more consistent
Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
2020-10-16 15:06:33 -05:00
9f98b3447c Merge pull request #7992 from containers/dependabot/go_modules/github.com/containers/common-0.25.0
Bump github.com/containers/common from 0.24.0 to 0.26.0
2020-10-16 09:27:44 -04:00
eefa3cbf6e Update podman-remote start --attach to handle detach keys
fixes #7979

Signed-off-by: Andy Librian <andylibrian@gmail.com>
2020-10-16 19:44:29 +07:00
480cb2db5e Update podman-remote run to handle detach keys
addresses #7979

Signed-off-by: Andy Librian <andylibrian@gmail.com>
2020-10-16 19:44:29 +07:00
fe1b6ccc85 Merge pull request #8029 from Luap99/image-trust-show-raw
Fix podman image trust show --raw output
2020-10-16 05:49:49 -04:00
711d4ba027 Bump github.com/containers/common from 0.24.0 to 0.26.0
Bumps [github.com/containers/common](https://github.com/containers/common) from 0.24.0 to 0.26.0.
- [Release notes](https://github.com/containers/common/releases)
- [Commits](https://github.com/containers/common/compare/v0.24.0...v0.26.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-16 04:38:06 -04:00
97fec29212 Fix panic when runlabel is missing
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-10-16 11:09:21 +08:00
c3ecdd09ed Merge pull request #8035 from xordspar0/fix-doc-heading
Fix podman-run man page heading
2020-10-15 14:24:02 -04:00
a261819183 Fix podman image trust show --raw output
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-10-15 19:04:57 +02:00
579a10157d Fix podman-run man page heading
Sharing IPC is meant to be an example under the Examples heading, not a
new section.

Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
2020-10-15 09:51:25 -05:00
571ae9db72 Fix sorting issues in completions
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-15 10:17:52 -04:00
a82d60db0f Merge pull request #8030 from Luap99/fix-restore-panic
Fix possible panic in libpod container restore
2020-10-15 10:09:40 -04:00
db23e12611 Add support for external container
External containers are containers created outside of Podman.
For example Buildah and CRI-O Containers.

$ buildah from alpine
alpine-working-container
$ buildah run alpine-working-container touch /test
$ podman container exists --external alpine-working-container

$ podman container diff alpine-working-container
C /etc
A /test

Added --external flag to refer to external containers, rather then --storage.

Added --external for podman container exists and modified podman ps to use
--external rather then --storage.  It was felt that --storage would confuse
the user into thinking about changing the storage driver or options.

--storage is still supported through the use of aliases.

Finally podman contianer diff, does not require the --external flag, since it
there is little change of users making the mistake, and would just be a pain
for the user to remember the flag.

podman container exists --external is required because it could fool scripts
that rely on the existance of a Podman container, and there is a potential
for a partial deletion of a container, which could mess up existing users.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-15 09:51:31 -04:00
22c8270135 fix podman container exists and diff for storage containers
Current these commands only check if a container exists in libpod. With
this fix, the commands will also check if they are in containers/storage.

This allows users to look at differences within a buildah or CRI-O container.

Currently buildah diff does not exists, so this helps out in that situation
as well as in CRI-O since the cri does not implement a diff command.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-15 09:51:15 -04:00
a1d5a518d3 Merge pull request #8028 from containers/dependabot/go_modules/github.com/spf13/cobra-1.1.0
Bump github.com/spf13/cobra from 1.0.0 to 1.1.0
2020-10-15 09:32:50 -04:00
d7a1e3fe2a Merge pull request #8003 from containers/dependabot/go_modules/github.com/onsi/gomega-1.10.3
Bump github.com/onsi/gomega from 1.10.2 to 1.10.3
2020-10-15 07:35:23 -04:00
ef7f584acf Merge pull request #8025 from edsantiago/bats
System test additions
2020-10-15 06:19:07 -04:00
2e65497dea Fix possible panic in libpod container restore
We need to do a length check before we can access the
networkStatus slice by index to prevent a runtime panic.

Fixes #8026

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-10-15 11:50:29 +02:00
41eda417fe Merge pull request #8013 from rhatdan/homedir
Setup HOME environment when using --userns=keep-id
2020-10-15 05:09:40 -04:00
e6d3c492a0 Bump github.com/spf13/cobra from 1.0.0 to 1.1.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spf13/cobra/compare/v1.0.0...v1.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-15 04:46:01 -04:00
1646da834c System test additions
- run --userns=keep-id: confirm that $HOME gets set (#8013)

 - inspect: confirm that JSON output is a sane number of
   lines (10 or more), not an unreadable one-liner (#8011
   and #8021). Do so with image, pod, network, volume
   because the code paths might be different.

 - cgroups: confirm that 'run' preserves cgroup manager (#7970)

 - sdnotify: reenable tests, and hope CI doesn't hang. This
   test was disabled on August 18 because CI jobs were hanging
   and timing out. My suspicion was that it was #7316, which
   in turn seems to have hinged on conmon #182. The latter
   was merged on Sep 16, so let's cross our fingers and see
   what happens.

Also: remove inaccurate warning from a networking test.

And, wow, fix is_cgroupsv2(), it has never actually worked.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-10-14 15:32:02 -06:00
1814bac92e Setup HOME environment when using --userns=keep-id
Currently the HOME environment is set to /root if
the user does not override it.

Also walk the parent directories of users homedir
to see if it is volume mounted into the container,
if yes, then set it correctly.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-14 15:31:56 -06:00
6ca8067956 Setup HOME environment when using --userns=keep-id
Currently the HOME environment is set to /root if
the user does not override it.

Also walk the parent directories of users homedir
to see if it is volume mounted into the container,
if yes, then set it correctly.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-14 16:45:24 -04:00