4885 Commits

Author SHA1 Message Date
b59abdc1b1 Merge pull request #3579 from QiWang19/dns_net
fix --dns and --network conflict
2019-07-19 02:22:28 +02:00
b98e015527 Merge pull request #3597 from cevich/fix_cmd_not_found
Cirrus: Minor scripting typo fix
2019-07-19 01:40:05 +02:00
2254a35d3a Merge pull request #3593 from giuseppe/rootless-privileged-devices
rootless: add host devices with --privileged
2019-07-18 19:50:22 +02:00
5047c79e71 support podman ps filter regular expressions
podman ps --filter use regexp to match the container name.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-07-18 13:11:04 -04:00
1065548f91 Merge pull request #3584 from QiWang19/pssize
podman-remote make --size optional in ps
2019-07-18 18:04:47 +02:00
350ede1eeb rootless: add rw devices with --privileged
when --privileged is specified, add all the devices that are usable by
the user.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1730773

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-07-18 17:07:50 +02:00
67098029bc Cirrus: Minor scripting typo fix
Signed-off-by: Chris Evich <cevich@redhat.com>
2019-07-18 10:40:26 -04:00
ade0d8778f Merge pull request #3509 from giuseppe/cgroup-namespace
libpod: support for cgroup namespace
2019-07-18 16:14:52 +02:00
22e62e8691 Merge pull request #3595 from mheon/fix_exec_leak
Remove exec PID files after use to prevent memory leaks
2019-07-18 15:52:57 +02:00
3f721f8b17 fix --dns* and --network not set to host conflict
Close #3553
This PR makes --dns, --dns-option, --dns-search, and --network not set to host flag mutually exclusive for podman build and create. Returns conflict error if both flags are set.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-07-18 09:39:31 -04:00
c244c347b1 podman-remote make --size optional in ps
Close #3578 Add `size` field to PsOpts in podman remote to receive size as an option.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-07-18 09:34:19 -04:00
5bbede9d9f Remove exec PID files after use to prevent memory leaks
We have another patch running to do the same for exit files, with
a much more in-depth explanation of why it's necessary. Suffice
to say that persistent files in tmpfs tied to container CGroups
lead to significant memory allocations that last for the lifetime
of the file.

Based on a patch by Andrea Arcangeli (aarcange@redhat.com).

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-07-18 09:06:11 -04:00
adcde2383f Merge pull request #3592 from openSUSE/aa-file
Add DefaultContent API to retrieve apparmor profile content
2019-07-18 14:15:33 +02:00
27ebd7d6f0 Add DefaultContent API to retrieve apparmor profile content
The default apparmor profile is not stored on disk which causes
confusion when debugging the content of the profile. To solve this, we
now add an additional API which returns the profile as byte slice.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-07-18 13:14:02 +02:00
456c045ddb Merge pull request #3591 from llchan/makefile-symlink-tweak
Tweak GOPATH-related symlinking
2019-07-18 12:23:07 +02:00
0b57e77d7c libpod: support for cgroup namespace
allow a container to run in a new cgroup namespace.

When running in a new cgroup namespace, the current cgroup appears to
be the root, so that there is no way for the container to access
cgroups outside of its own subtree.

By default it uses --cgroup=host to keep the previous behavior.

To create a new namespace, --cgroup=private must be provided.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-07-18 10:32:25 +02:00
7488ed6d9a Merge pull request #3522 from mheon/nix_the_artifact
Move the HostConfig portion of Inspect inside libpod
2019-07-18 09:23:47 +02:00
2be57e1386 Make GOPATH-related symlinking more precise
This change tweaks the symlink commands that are invoked when libpod is
not on GOPATH. This has the following effects:

- If the working directory is not "libpod", it will still create the
  symlink at the correct github.com/containers/libpod path.
- If the github.com/varlink directory/symlink already exists, it will
  still create the symlink at the intended path.

Signed-off-by: Lawrence Chan <element103@gmail.com>
2019-07-17 22:02:58 -05:00
b2734baee5 Merge pull request #3588 from haircommander/play-kube-command
Fix play kube command
2019-07-18 02:07:43 +02:00
c91bc31570 Populate inspect with security-opt settings
We can infer no-new-privileges. For now, manually populate
seccomp (can't infer what file we sourced from) and
SELinux/Apparmor (hard to tell if they're enabled or not).

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-07-17 16:48:38 -04:00
156b6ef222 Properly retrieve Conmon PID
Our previous method (just read the PID that we spawned) doesn't
work - Conmon double-forks to daemonize, so we end up with a PID
pointing to the first process, which dies almost immediately.

Reading from the PID file gets us the real PID.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-07-17 16:48:38 -04:00
1e3e99f2fe Move the HostConfig portion of Inspect inside libpod
When we first began writing Podman, we ran into a major issue
when implementing Inspect. Libpod deliberately does not tie its
internal data structures to Docker, and stores most information
about containers encoded within the OCI spec. However, Podman
must present a CLI compatible with Docker, which means it must
expose all the information in 'docker inspect' - most of which is
not contained in the OCI spec or libpod's Config struct.

Our solution at the time was the create artifact. We JSON'd the
complete CreateConfig (a parsed form of the CLI arguments to
'podman run') and stored it with the container, restoring it when
we needed to run commands that required the extra info.

Over the past month, I've been looking more at Inspect, and
refactored large portions of it into Libpod - generating them
from what we know about the OCI config and libpod's (now much
expanded, versus previously) container configuration. This path
comes close to completing the process, moving the last part of
inspect into libpod and removing the need for the create
artifact.

This improves libpod's compatability with non-Podman containers.
We no longer require an arbitrarily-formatted JSON blob to be
present to run inspect.

Fixes: #3500

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-07-17 16:48:38 -04:00
6f35a57423 Fix play kube command
Before, play kube wasn't properly setting the command. Fix this
Also, begin a dedicated test suite for play kube to catch regressions like this in the future

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-07-17 12:59:50 -04:00
1c02905ec7 Merge pull request #3583 from giuseppe/ulimit-host-not-set
spec: simplify handling of  --ulimit host
2019-07-17 18:18:09 +02:00
2f0ed531c7 spec: rework --ulimit host
it seems enough to not specify any ulimit block to maintain the host
limits.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-07-17 13:01:21 +02:00
04a9cb01fe Merge pull request #3335 from cevich/imgprune
Cirrus: Print images that should be pruned
2019-07-17 11:47:42 +02:00
fe83308631 Merge pull request #3548 from cevich/disable_periodic_activity
Cirrus: Disable most periodic services/timers
2019-07-16 22:16:24 +02:00
400851ac31 Merge pull request #3508 from csomh/healthcheck-flag-compat
Make the healthcheck flags compatible with Docker CLI
2019-07-16 21:23:52 +02:00
f58b754c8d Cirrus: Add image-test for locked dpkg
Signed-off-by: Chris Evich <cevich@redhat.com>
2019-07-16 14:30:42 -04:00
efdb7ad8f2 Cirrus: Use images w/o periodic svcs
Signed-off-by: Chris Evich <cevich@redhat.com>
2019-07-16 14:30:42 -04:00
1abb217493 Cirrus: Disable most periodic services/timers
For CI testing, it's important to remove as much variability from the
overall system as possible.  This permits focusing just on problems
closely related to code-changes.  To this end, and because VMs are very
short-lived (2 hours at most), disable all systemd services and timers
which perform periodic activities.

Signed-off-by: Chris Evich <cevich@redhat.com>
2019-07-16 14:30:42 -04:00
a449e9a2cf Merge pull request #3546 from cevich/abstract_dest_branch
Cirrus: Abstract destination branch refs.
2019-07-16 19:54:51 +02:00
386ffd28d6 Merge pull request #3539 from stefanb2/topic-pr-3507-3525
Fix handling of healthcheck from image
2019-07-16 16:38:09 +02:00
7e4db4452f Merge pull request #3513 from vrothberg/analyses
Binary bloat analyses
2019-07-16 15:52:50 +02:00
294ddc4720 dependency/analyses: simplify scripts
Credits to bash wizard @edsantiago for the changes.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-07-16 14:16:16 +02:00
25d63f009d dependency-tree analysis: direct and transitive
Change the script to generate two files.  One including direct
dependencies, the other including direct and transitive dependencies.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-07-16 14:16:16 +02:00
9ae3e7c1ec analyses: README: consistent code examples
Remove a blank line to make code examples more consistent and fix the
path of the 2nd example.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-07-16 14:16:16 +02:00
525c1ba897 analyses: README: fix typos
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-07-16 14:16:16 +02:00
849e2f3d4e analyses: add dependency-tree.sh
Add a new analysis script to print the dependency tree.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-07-16 14:16:16 +02:00
fb31cc95a5 analyses: add README.md
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-07-16 14:16:16 +02:00
88058c3ce2 hack/analyses -> dependencies/analyses
Move the analyses scripts to the dependencies directory to avoid
scattering of the dependency management.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-07-16 14:16:16 +02:00
65a600332d hack/analyses/go-archive-analysis.sh: fix sorting
Believe it or not:
`sort -ruh` is loosing data while `sort -u | sort -rh` does not.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-07-16 14:16:16 +02:00
7ab82579bb add hack/analyses/nm-symbols-analysis.sh
The script allows for analyzing the symbols of a go binary passed as an
argument.  The tabular output looks as follows:

336             unicode/utf8.DecodeLastRune
323             unicode/utf8.DecodeLastRuneInString
518             unicode/utf8.DecodeRune
518             unicode/utf8.DecodeRuneInString
337             unicode/utf8.EncodeRune

The first column indicates the size in bytes of the symbol in the second
column.  Note that only text symbols are considered, other symbols from
the data or the bss segment are ignored to avoid information overload.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-07-16 14:16:16 +02:00
aa28dbbf88 analyse package sizes
Analyse the size of all go-packages used during the build process via
the newly added `hack/analyses/go-archive-analysis.sh` script.  The
script expects the `WORK` environment variable to be set, which points
to a temporary work directory generated by `go build`.  To generate such
a work directory, set the `BUILDFLAGS="-work -a"`:

 * `-work` for creating the work directory
 * `-a` to force rebuilding all packages even when already cached

The workflow may look as follows:

```
$ BUILDFLAGS="-work -a" make podman
[...]
WORK=/tmp/go-build127001249
$ WORK=/tmp/go-build127001249 ./hack/analyses/go-archive-analysis.sh
```

The output of the script has the format `$SIZE $PACKAGE` where $SIZE is
the size of the compiled version of the go package (i.e., `.a` file) and
$PACKAGE for the corresponding package, for instance, `math/big` for a
stdlib package or vendor/...  for vendored packages.

Credits to the authors of https://github.com/jondot/goweight, which
inspired this work.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-07-16 14:16:16 +02:00
47c1fe6a5c Completion: complete "--health-start-period" in bash
Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
2019-07-16 06:15:30 +02:00
3e53bfe36e Make the healthcheck flags compatible with Docker CLI
Docker CLI calls the healthcheck flags "--health-*", instead of
"--healthcheck-*".

Introduce the former, in order to keep compatibility, and alias
the later, in order to avoid breaking current usage.

Change "--healthcheck-*" to "--health-*" in the docs and tests.

Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
2019-07-16 06:15:28 +02:00
5ed2de158f healthcheck: reject empty commands
An image with "HEALTHCHECK CMD ['']" is valid but as there is no command
defined the healthcheck will fail. Reject such a configuration.

Fixes #3507

Signed-off-by: Stefan Becker <chemobejk@gmail.com>
2019-07-16 07:01:43 +03:00
5caf218b11 create: ignore check if image has HEALTHCHECK NONE
If the image was built with "HEALTHCHECK NONE" then we should create a
container without healthcheck configuration. Otherwise executing the
healthcheck on the container will return "unhealthy" instead of the
correct error message that the container doesn't have a healthcheck.

We also ignore the healthcheck configuration if the command list is
empty or the command string is empty.

Fixes #3525

Signed-off-by: Stefan Becker <chemobejk@gmail.com>
2019-07-16 07:01:43 +03:00
33001a9028 create: apply defaults on image healthcheck options
If the image doesn't provide any options, e.g. interval, timeout, etc.,
then apply the Docker defaults when creating the container. Otherwise
the defaults will be left 0 and podman doesn't schedule the healtcheck
service & timer for the container or incorrectly reports unhealthy state
when the check is executed.

Fixes #3525

Signed-off-by: Stefan Becker <chemobejk@gmail.com>
2019-07-16 07:01:43 +03:00
dd0ea08cef healthcheck: improve command list parser
- remove duplicate check, already called in HealthCheck()
- reject zero-length command list and empty command string as errorneous
- support all Docker command list keywords: NONE, CMD or CMD-SHELL
- use Docker default "/bin/sh -c" for CMD-SHELL

Fixes #3507

Signed-off-by: Stefan Becker <chemobejk@gmail.com>
2019-07-16 07:01:43 +03:00