2707 Commits

Author SHA1 Message Date
ac426bada2 Merge pull request #2121 from giuseppe/always-cleanup-rootless-containers
createconfig: always cleanup a rootless container
2019-01-10 10:43:32 -05:00
f2ff550967 Fix handling of nil volumes
Currently if a user passes in a -v with
-v $bogus:/foobar

We crash.  This will throw a proper error.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-10 10:27:39 -05:00
69c3e32941 Merge pull request #2122 from giuseppe/sign-fixes
sign: some fixes
2019-01-10 07:13:32 -08:00
d196d9c816 Merge pull request #2095 from rhatdan/completions
Add Validate completions
2019-01-10 05:02:39 -08:00
4e234136bc sign: make all error messages lowercase
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-10 13:37:26 +01:00
23633f4619 sign: use filepath.Join instead of fmt.Sprintf
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-10 13:13:41 +01:00
7ba38b375f createconfig: always cleanup a rootless container
the rootless container storage is always mounted in a different mount
namespace, owned by the unprivileged user.  Even if it is mounted, a
process running in another namespace cannot reuse the already mounted
storage.

Make sure the storage is always cleaned up once the container
terminates.

This has worked with vfs since there is no real mounted storage.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-10 13:02:58 +01:00
64627d910b Merge pull request #2114 from vrothberg/issue-2107
apparmor: apply default profile at container initialization
2019-01-10 03:34:54 -08:00
b01b2a78f4 Fix 'image trust' from PR1899
Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-01-09 17:48:47 -05:00
0f6535cf6b libpod/image: Use ParseNormalizedNamed in RepoDigests
Avoid generating
quay.io/openshift-release-dev/ocp-release@sha256@sha256:239... and
similar when the image name is already digest-based [1].  It's not
clear exactly how we get into this state, but as shown by the unit
tests, the new code handles this case correctly (while the previous
code does not).

[1]: https://github.com/containers/libpod/issues/2086

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #2106
Approved by: rhatdan
2019-01-09 22:29:18 +00:00
a60090cfba Merge pull request #2115 from rhatdan/shm
If you fail to open shm lock then attempt to create it
2019-01-09 13:41:07 -08:00
edb285d176 apparmor: apply default profile at container initialization
Apply the default AppArmor profile at container initialization to cover
all possible code paths (i.e., podman-{start,run}) before executing the
runtime.  This allows moving most of the logic into pkg/apparmor.

Also make the loading and application of the default AppArmor profile
versio-indepenent by checking for the `libpod-default-` prefix and
over-writing the profile in the run-time spec if needed.

The intitial run-time spec of the container differs a bit from the
applied one when having started the container, which results in
displaying a potentially outdated AppArmor profile when inspecting
a container.  To fix that, load the container config from the file
system if present and use it to display the data.

Fixes: #2107
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-01-09 22:18:11 +01:00
55583bdfa6 Fix up image sign and trust
Add completions
Fix man pages
fix code in sign to answer PR Comments.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-09 15:19:46 -05:00
8c25a645ac If you fail to open shm lock then attempt to create it
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-09 14:57:24 -05:00
c37f731596 Merge pull request #2040 from QiWang19/signimg
Support podman image sign
2019-01-09 09:09:10 -08:00
7b9d4f1c92 Merge pull request #2061 from adrianreber/static-ip
Use existing interface to request IP address during restore
2019-01-09 07:41:47 -08:00
506108194a Merge pull request #2087 from wking/kind-bug
.github/ISSUE_TEMPLATE: Suggest '/kind bug' and '/kind feature'
2019-01-09 05:12:32 -08:00
7f91ebb441 Merge pull request #2103 from debarshiray/wip/debarshiray/man-page-order-long-short-options
List the long variant of each option before its shorter counterpart
2019-01-09 03:04:53 -08:00
0a7373e802 Merge pull request #1830 from wking/config-filter-hooks
hooks: Add pre-create hooks for runtime-config manipulation
2019-01-09 02:32:52 -08:00
bdf8965846 List the long variant of each option before its shorter counterpart
This is the style followed in most of the other man pages.

Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
2019-01-09 11:14:06 +01:00
2553dad766 Use existing interface to request IP address during restore
The initial implementation to request the same IP address for a
container during a restore was based on environment variables
influencing CNI.

With this commit the IP address selection switches to Podman's internal
static IP API.

This commit does a comment change in libpod/container_easyjson.go to
avoid unnecessary re-generation of libpod/container_easyjson.go during
build as this fails in CI. The reason for this is that make sees that
libpod/container_easyjson.go needs to be re-created. The commit,
however, only changes a part of libpod/container.go which is marked as
'ffjson: skip'.

Signed-off-by: Adrian Reber <areber@redhat.com>
2019-01-09 07:34:57 +01:00
ab8e03b3e7 Added checkpoint/restore test for same IP
Restoring a container from a checkpoint should give the container the
same IP as before checkpointing. This adds a test to make sure the IP
stays the same.

Signed-off-by: Adrian Reber <areber@redhat.com>
2019-01-09 07:34:57 +01:00
e11cbd7129 Enable checkpoint test with established TCP connections
Signed-off-by: Adrian Reber <areber@redhat.com>
2019-01-09 07:34:57 +01:00
3018e724c0 .github/ISSUE_TEMPLATE: Suggest '/kind bug' and '/kind feature'
So Prow's label plugin [1] can apply the appropriate label for us.

[1] https://github.com/kubernetes/test-infra/tree/master/prow/plugins/label

Signed-off-by: W. Trevor King <wking@tremily.us>
2019-01-08 21:07:53 -08:00
99e642d940 pkg/hooks/exec: Include failed command in hook errors
For example:

  $ cat /etc/containers/oci/hooks.d/test.json
  {
    "version": "1.0.0",
    "hook": {
      "path": "/bin/sh",
      "args": ["sh", "-c", "echo 'oh, noes!' >&2; exit 1"]
    },
    "when": {
      "always": true
    },
    "stages": ["precreate"]
  }
  $ podman run --rm docker.io/library/alpine echo 'successful container'
  error setting up OCI Hooks: executing [sh -c echo 'oh, noes!' >&2; exit 1]: exit status 1

The rendered command isn't in in the right syntax for copy/pasting
into a shell, but it should be enough for the user to be able to
locate the failing hook.  They'll need to know their hook directories,
but with the previous commits requiring explicit hook directories it's
more likely that the caller is aware of them.  And if they run at a
debug level, they can see the lookups in the logs:

  $ podman --log-level=debug --hooks-dir=/etc/containers/oci/hooks.d run --rm docker.io/library/alpine echo 'successful container' 2>&1 | grep -i hook
  time="2018-12-02T22:15:16-08:00" level=debug msg="reading hooks from /etc/containers/oci/hooks.d"
  time="2018-12-02T22:15:16-08:00" level=debug msg="added hook /etc/containers/oci/hooks.d/test.json"
  time="2018-12-02T22:15:16-08:00" level=debug msg="hook test.json matched; adding to stages [precreate]"
  time="2018-12-02T22:15:16-08:00" level=warning msg="container 3695c6ba0cc961918bd3e4a769c52bd08b82afea5cd79e9749e9c7a63b5e7100: precreate hook: executing [sh -c echo 'oh, noes!' >&2; exit 1]: exit status 1"
  time="2018-12-02T22:15:16-08:00" level=error msg="error setting up OCI Hooks: executing [sh -c echo 'oh, noes!' >&2; exit 1]: exit status 1"

Signed-off-by: W. Trevor King <wking@tremily.us>
2019-01-08 21:06:17 -08:00
c441d51e05 hooks/exec/runtimeconfigfilter: Log config changes
To make it easier to notice and track down errors (or other surprising
behavior) due to precreate hooks.  With this commit, the logged
messages look like:

  time="2018-11-19T13:35:18-08:00" level=debug msg="precreate hook 0 made configuration changes:
  --- Old
  +++ New
  @@ -18,3 +18,3 @@
     Namespaces: ([]specs.LinuxNamespace) <nil>,
  -  Devices: ([]specs.LinuxDevice) (len=1) {
  +  Devices: ([]specs.LinuxDevice) (len=2) {
      (specs.LinuxDevice) {
  @@ -24,2 +24,11 @@
       Minor: (int64) 229,
  +    FileMode: (*os.FileMode)(-rw-------),
  +    UID: (*uint32)(0),
  +    GID: (*uint32)(0)
  +   },
  +   (specs.LinuxDevice) {
  +    Path: (string) (len=8) "/dev/sda",
  +    Type: (string) (len=1) "b",
  +    Major: (int64) 8,
  +    Minor: (int64) 0,
       FileMode: (*os.FileMode)(-rw-------),
  "
  time="2018-11-19T13:35:18-08:00" level=debug msg="precreate hook 1 made configuration changes:
  --- Old
  +++ New
  @@ -29,3 +29,3 @@
      (specs.LinuxDevice) {
  -    Path: (string) (len=8) "/dev/sda",
  +    Path: (string) (len=8) "/dev/sdb",
       Type: (string) (len=1) "b",
  "

Ideally those logs would include the container ID, but we don't have
access to that down at this level.  I'm not sure if it's worth
teaching RuntimeConfigFilter to accept a *logrus.Entry (so the caller
could use WithFields [1]) or to use a generic logging interface (like
go-log [2]).  For now, I've left the container ID unlogged here.

The spew/difflib implementation is based on stretchr/testify/assert,
but I think the ~10 lines I'm borrowing are probably small enough to
stay under the "all copies or substantial portions" condition in its
MIT license.

[1]: https://godoc.org/github.com/sirupsen/logrus#WithFields
[2]: https://github.com/go-log/log

Signed-off-by: W. Trevor King <wking@tremily.us>
2019-01-08 21:06:17 -08:00
f6a2b6bf2b hooks: Add pre-create hooks for runtime-config manipulation
There's been a lot of discussion over in [1] about how to support the
NVIDIA folks and others who want to be able to create devices
(possibly after having loaded kernel modules) and bind userspace
libraries into the container.  Currently that's happening in the
middle of runc's create-time mount handling before the container
pivots to its new root directory with runc's incorrectly-timed
prestart hook trigger [2].  With this commit, we extend hooks with a
'precreate' stage to allow trusted parties to manipulate the config
JSON before calling the runtime's 'create'.

I'm recycling the existing Hook schema from pkg/hooks for this,
because we'll want Timeout for reliability and When to avoid the
expense of fork/exec when a given hook does not need to make config
changes [3].

[1]: https://github.com/opencontainers/runc/pull/1811
[2]: https://github.com/opencontainers/runc/issues/1710
[3]: https://github.com/containers/libpod/issues/1828#issuecomment-439888059

Signed-off-by: W. Trevor King <wking@tremily.us>
2019-01-08 21:06:17 -08:00
c9d63fe89d Merge pull request #2097 from debarshiray/wip/debarshiray/podman-exec-workdir
Add a --workdir option to 'podman exec'
2019-01-08 10:21:14 -08:00
db19bed6e8 Add Validate completions
In podman 0.12.0 we have invalid completions.  These should have been
caught during testing. This check will throw an error if the completions
do not successfully execute.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-01-08 12:55:21 -05:00
757906189e Merge pull request #2094 from debarshiray/wip/debarshiray/podman-start-sig-proxy-default-doc
Mention the default --sig-proxy value for 'podman start'
2019-01-08 09:04:17 -08:00
867669374c Add a --workdir option to 'podman exec'
Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
2019-01-08 17:42:37 +01:00
e02199f2a4 Default --sig-proxy to true for 'podman start --attach'
The --sig-proxy option in both 'podman attach' and 'podman run' default
to true, and there's no reason for 'podman start --attach' to be any
different. However, since it only makes sense to proxy signals when
the container is attached, 'podman start --sig-proxy' will continue to
error if --attach isn't used.

Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
2019-01-08 16:34:09 +01:00
f71264e612 Test that 'podman start --sig-proxy' does not work without --attach
Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
2019-01-08 16:34:09 +01:00
9474b8cea2 Merge pull request #2099 from mheon/config_to_containerconfig
Rename libpod.Config back to ContainerConfig
2019-01-08 07:06:09 -08:00
bce22dc621 [WIP]Support podman image sign
Generate a signature claim for an image using user keyring (--sign-by). The signature file will be stored in simple json format under the default or the given directory (--directory or yaml file in /etc/containers/registries.d/).

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-01-08 09:53:18 -05:00
4f19f1afca Merge pull request #2076 from rhatdan/storage.conf
If local storage file exists, then use it rather then defau…
2019-01-08 05:55:40 -08:00
1ebed88283 Merge pull request #2101 from vrothberg/vendor-buildah
vendor latest buildah
2019-01-08 05:34:49 -08:00
454ad71fd4 vendor latest buildah
Allow parallel copying from the blobcache.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-01-08 12:34:40 +01:00
faa24627bb Merge pull request #2078 from rhatdan/config.file
Add the configuration file used to setup storage to podman info
2019-01-07 14:27:19 -08:00
628b14ada7 Merge pull request #2064 from afbjorklund/exec-env
Honor image environment variables with exec
2019-01-07 13:35:52 -08:00
90b5b935a3 Merge pull request #2100 from cevich/very_small_simplification
Minor: Remove redundant basename command in ooe.sh
2019-01-07 12:32:34 -08:00
83ac4f8277 Honor image environment variables with exec
Was reading the "env" argument twice instead of image.

Closes #2063

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2019-01-07 21:07:23 +01:00
8c8d895d66 Merge pull request #2098 from baude/remote
Add ability to build golang remote client
2019-01-07 11:54:55 -08:00
b9814e76b2 Minor: Remove redundant basename command in ooe.sh
Signed-off-by: Chris Evich <cevich@redhat.com>
2019-01-07 14:41:52 -05:00
5ed23327a9 Rename libpod.Config back to ContainerConfig
During an earlier bugfix, we swapped all instances of
ContainerConfig to Config, which was meant to fix some data we
were returning from Inspect. This unfortunately also renamed a
libpod internal struct for container configs. Undo the rename
here.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-01-07 14:37:51 -05:00
be84d9727e Merge pull request #2096 from vrothberg/vendor-buildah
vendor latest buildah
2019-01-07 11:36:10 -08:00
41fb81d074 Add ability to build golang remote client
Add the ability to build a remote client in golang that uses all
the same front-end cli code and output code. The initial limitations
here are that it can only be a local client while the bridge and
resolver code is being written for the golang varlink client.

Tests and docs will be added in subsequent PRs.

Signed-off-by: baude <bbaude@redhat.com>
2019-01-07 12:43:57 -06:00
b88a78a6be vendor latest buildah
Pulls in fixes for determining insecure registries by removing redundant
wrapper code and instead using the API of sysregistriesv2 directly.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-01-07 18:13:39 +01:00
148b4920dc Merge pull request #2075 from baude/runlabelname
container runlabel NAME implementation
2019-01-07 08:43:53 -08:00
d0b166023f Merge pull request #2083 from mheon/shm_locking_fixes
Address lingering review comments from SHM locking PR
2019-01-07 07:49:49 -08:00