Commit graph

260 commits

Author SHA1 Message Date
Jhon Honce 9074565f4e Implement pod varlink bindings
* Update varlink document
* Add NoContainersInPod error in go and python
* Add support for varlink pod interface
* New code passes pylint
* Fix bug in test_runner.sh
* Update integration tests for race condition on status check
* Add missing port config file support

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-10-01 07:24:50 -07:00
Giuseppe Scrivano abde1ef0ef
rootless: raise an error when trying to use cgroups
https://github.com/containers/libpod/issues/1429#issuecomment-424040416

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-10-01 09:33:12 +02:00
Daniel J Walsh 87c255f29f
Don't tmpcopyup on systemd cgroup
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-09-29 06:00:47 +02:00
baude 6db7027e97 Add buildah version and distribution to info
For the sake of debug and problem reporting, we would benefit from knowing
what buildah version was vendored into podman.  Also, knowing the distribution
and distribution version would also be handy.

Signed-off-by: baude <bbaude@redhat.com>
2018-09-28 10:48:16 -05:00
Daniel J Walsh 52c1365f32 Add --mount option for create & run command
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1524
Approved by: mheon
2018-09-21 21:33:41 +00:00
Matthew Heon 9e81f9daa4 Refactor Wait() to not require a timeout
We added a timeout for convenience, but most invocations don't
care about it. Refactor it into WaitWithTimeout() and add a
Wait() that doesn't require a timeout and uses the default.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1527
Approved by: mheon
2018-09-21 20:07:51 +00:00
Daniel J Walsh 09f506930c Don't mount /dev/shm if the user told you --ipc=none
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1466
Approved by: mheon
2018-09-21 19:06:12 +00:00
Giuseppe Scrivano 4f42fe2e9e rootless: error out if there are not enough UIDs/GIDs available
Most container images assume there are at least 65536 UIDs/GIDs
available.  Raise an error if there are not enough IDs allocated to
the current user.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1520
Approved by: rhatdan
2018-09-21 14:34:58 +00:00
Giuseppe Scrivano 37b2601a81 rootless: skip usage of filepath.Join
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1507
Approved by: rhatdan
2018-09-21 10:13:39 +00:00
Giuseppe Scrivano 6d1eecf7cf create, rootless: join the userns of ns:PATH
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1507
Approved by: rhatdan
2018-09-21 10:13:39 +00:00
Giuseppe Scrivano 8b9b493b53 spec: refactor ns modes to a common interface
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1507
Approved by: rhatdan
2018-09-21 10:13:39 +00:00
Daniel J Walsh fbfcc7842e Add new field to libpod to indicate whether or not to use labelling
Also update some missing fields libpod.conf obtions in man pages.

Fix sort order of security options and add a note about disabling
labeling.

When a process requests a new label.  libpod needs to reserve all
labels to make sure that their are no conflicts.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1406
Approved by: mheon
2018-09-20 16:01:29 +00:00
Daniel J Walsh 92b28a88d8
Vendor in latest containers/buildah
Switch from projectatomic/buildah to containers/buildah

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-09-18 17:20:30 -04:00
Matthew Heon e4770b8289 Small updates to OCI spec generation
Firstly, when adding the privileged catch-all resource device,
first remove the spec's default catch-all resource device.

Second, remove our default rootfs propogation config - Docker
does not set this by default, so I don't think we should either.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1491
Approved by: TomSweeneyRedHat
2018-09-17 22:13:42 +00:00
Matthew Heon 5622de9c61
Merge pull request #1467 from rhatdan/dev
Don't mount /dev/* if user mounted /dev
2018-09-14 17:26:38 -04:00
Matthew Heon a7b6a0fd16
Merge pull request #1474 from baude/varlinkinforegistries
add registry information to varlink info
2018-09-14 16:53:53 -04:00
Matthew Heon 0405555345
Merge pull request #1434 from rhatdan/wait
Add --interval flag to podman wait
2018-09-14 16:52:13 -04:00
Daniel J Walsh 31294799c4
Don't mount /dev/* if user mounted /dev
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-09-14 13:28:19 -04:00
baude 6f47eb0b28 add registry information to varlink info
when using the varlink api, we should pass on the registries information
as is present in the cli info command.

Signed-off-by: baude <bbaude@redhat.com>
2018-09-14 10:13:07 -05:00
Matthew Heon e2137cd009 Swap default mount propagation from private to rprivate
This matches Docker behavior more closely and should resolve an
issue we were seeing with /sys mounts

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1465
Approved by: rhatdan
2018-09-13 21:35:44 +00:00
Daniel J Walsh 9ec82caa31
Add --interval flag to podman wait
Waiting uses a lot of CPU, so drop back to checking once/second
and allow user to pass in the interval.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-09-13 10:11:00 -04:00
Daniel J Walsh d9580ec62b Pass on securityOpts from podInfraContainer to container added to pod.
This is an incomplete fix, as it would be best for the libpod library to be in charge of coordinating the container's dependencies on the infra container. A TODO was left as such. UTS is a special case, because the docker library that namespace handling is based off of doesn't recognize a UTS based on another container as valid, despite the library being able to handle it correctly. Thus, it is left in the old way.

Signed-off-by: haircommander <pehunt@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1347
Approved by: mheon
2018-09-11 13:31:55 +00:00
Matthew Heon d377a51578 Replace existing iptables handler with firewall code
Use the new firewall code vendored from CNI to replace the
existing iptables rule addition handler we had in place. This
adds proper support for firewalld and should be much better at
interacting with the firewall.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1431
Approved by: baude
2018-09-10 18:53:27 +00:00
Matthew Heon 9405e3704f Vendor CNI plugins firewall code
The upstream CNI project has a PR open for adding iptables and
firewalld support, but this has been stalled for the better part
of a year upstream.

On advice of several maintainers, we are vendoring this code into
libpod, to perform the relevant firewall configuration ourselves.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1431
Approved by: baude
2018-09-10 18:53:27 +00:00
Daniel J Walsh 87f90ce14a Fix pod sharing for utsmode
We should be sharing cgroups namespace by default in pods
uts namespace sharing was broken in pods.

Create a new libpod/pkg/namespaces for handling of namespace fields
in containers

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1418
Approved by: mheon
2018-09-07 18:18:54 +00:00
Matthew Heon ccc4a339cd Respect user-added mounts over default spec mounts
When there was a conflict between a user-added volume and a mount
already in the spec, we previously respected the mount already in
the spec and discarded the user-added mount. This is counter to
expected behavior - if I volume-mount /dev into the container, I
epxect it will override the default /dev in the container, and
not be ignored.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1419
Approved by: TomSweeneyRedHat
2018-09-07 17:50:58 +00:00
Matthew Heon 2e89e5a204 Ensure we do not overlap mounts in the spec
When user-specified volume mounts overlap with mounts already in
the spec, remove the mount in the spec to ensure there are no
conflicts.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1419
Approved by: TomSweeneyRedHat
2018-09-07 17:50:58 +00:00
Daniel J Walsh 6f2bd8d795 Change references to cri-o to point at new repository
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1425
Approved by: mheon
2018-09-07 17:47:45 +00:00
umohnani8 7ffb8a7900 Add CRI logs parsing to podman logs
Podman logs was not parsing CRI logs well, especially
the F and P logs. Now using the same parsing code as
in kube here.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #1403
Approved by: rhatdan
2018-09-05 13:48:20 +00:00
Giuseppe Scrivano 807f6f8d8f rootless: check uid with Geteuid() instead of Getuid()
change the tests to use chroot to set a numeric UID/GID.

Go syscall.Credential doesn't change the effective UID/GID of the
process.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1372
Approved by: mheon
2018-09-04 14:36:57 +00:00
Daniel J Walsh 27ca091c08
Add proper support for systemd inside of podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-08-31 14:42:32 -04:00
Giuseppe Scrivano 86aefb5de2 rootless: unexport GetUserNSForPid
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1371
Approved by: rhatdan
2018-08-29 16:25:20 +00:00
Giuseppe Scrivano 1789242933 rootless: add new function to join existing namespace
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1371
Approved by: rhatdan
2018-08-29 16:25:20 +00:00
Daniel J Walsh eb5fdebc84 Vendor in latest projectatomic/buildah
This will help document the defaults in podman build.

podman build --help will now show the defaults and mention
the environment variables that can be set to change them.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1364
Approved by: mheon
2018-08-29 14:27:11 +00:00
Matthew Heon 6a46af571e Set nproc in containers unless explicitly overridden
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1355
Approved by: rhatdan
2018-08-28 17:32:24 +00:00
Matthew Heon f86f5d3e59 Do not set max open files by default if we are rootless
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1355
Approved by: rhatdan
2018-08-28 17:32:24 +00:00
Matthew Heon 9da94c454f Set default max open files in spec
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1355
Approved by: rhatdan
2018-08-28 17:32:24 +00:00
baude bfedcb4f3c Ensure return errors match API docs
In the API docs, we generally state the type of error that should be returned
if a container or image cannot be found.  In several cases, the code did not
match the API doc, when the API doc was correct.

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

Closes: #1353
Approved by: rhatdan
2018-08-28 10:11:21 +00:00
Giuseppe Scrivano 663ee91eec Fix Mount Propagation
Default mount propagation inside of containes should be private

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1305
Approved by: mheon
2018-08-27 13:26:28 +00:00
Giuseppe Scrivano 5f0a1c1ff8 rootless: fix --pid=host
Unfortunately this is not enough to get it working as runc doesn't
allow to bind mount /proc.

Depends on: https://github.com/opencontainers/runc/pull/1832

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1349
Approved by: rhatdan
2018-08-27 12:49:32 +00:00
Giuseppe Scrivano bee654296b rootless: fix --ipc=host
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1349
Approved by: rhatdan
2018-08-27 12:49:32 +00:00
Giuseppe Scrivano bbbdd45b2c spec: bind mount /sys only when userNS are enabled
Fix the test for checking when /sys must be bind mounted from the
host.  It should be done only when userNS are enabled (the
!UsernsMode.IsHost() check is not enough for that).

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1349
Approved by: rhatdan
2018-08-27 12:49:32 +00:00
Giuseppe Scrivano c5753f57c1 rootless: exec handle processes that create an user namespace
Manage the case where the main process of the container creates and
joins a new user namespace.

In this case we want to join only the first child in the new
hierarchy, which is the user namespace that was used to create the
container.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1331
Approved by: rhatdan
2018-08-26 07:22:42 +00:00
Giuseppe Scrivano 720eb85ba5 rootless: fix exec
We cannot re-exec into a new user namespace to gain privileges and
access an existing as the new namespace is not the owner of the
existing container.

"unshare" is used to join the user namespace of the target container.

The current implementation assumes that the main process of the
container didn't create a new user namespace.

Since in the setup phase we are not running with euid=0, we must skip
the setup for containers/storage.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1331
Approved by: rhatdan
2018-08-26 07:22:42 +00:00
Kunal Kushwaha af9f83f11c exposes tcp port only if no proto specified.
Also it fix the issue of exposing both tc/udp port even if
only one proto specified.

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>

Closes: #1325
Approved by: mheon
2018-08-24 14:31:38 +00:00
Daniel J Walsh e7fbf329c2 Reveal information about container capabilities
I am often asked about the list of capabilities availabel to a container.
We should be listing this data in the inspect command for effective
capabilities and the bounding set.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1335
Approved by: TomSweeneyRedHat
2018-08-24 12:16:19 +00:00
haircommander 0e6266858a Fixing network ns segfault
As well as small style corrections, update pod_top_test to use CreatePod, and move handling of adding a container to the pod's namespace from container_internal_linux to libpod/option.

Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1187
Approved by: mheon
2018-08-23 18:16:28 +00:00
haircommander 2a7449362f Change pause container to infra container
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1187
Approved by: mheon
2018-08-23 18:16:28 +00:00
haircommander 697b46430a Support pause containers in varlink
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1187
Approved by: mheon
2018-08-23 18:16:28 +00:00
haircommander d5e690914d Added option to share kernel namespaces in libpod and podman
A pause container is added to the pod if the user opts in. The default pause image and command can be overridden. Pause containers are ignored in ps unless the -a option is present. Pod inspect and pod ps show shared namespaces and pause container. A pause container can't be removed with podman rm, and a pod can be removed if it only has a pause container.

Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1187
Approved by: mheon
2018-08-23 18:16:28 +00:00
haircommander 63dd200e7e Changed GetContainerStats to return ErrCtrStateInvalid
This results in some functionality changes:

If a ErrCtrStateInvalid is returned to GetPodStats, the container is ommitted from the stats.
As such, if an empty slice of Container stats are returned to GetPodStats in varlink, an error will occur.
GetContainerStats will return the ErrCtrStateInvalid as well.
Finally, if ErrCtrStateInvalid is returned to the podman stats call, the container will be ommitted from the stats.

Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1319
Approved by: baude
2018-08-23 15:58:08 +00:00
haircommander 3df6332a65 Add GetPodStats to varlink
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1319
Approved by: baude
2018-08-23 15:58:08 +00:00
Giuseppe Scrivano 77bcc89d52 rootless: fix --net host --privileged
Closes: https://github.com/containers/libpod/issues/1313

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1323
Approved by: umohnani8
2018-08-22 20:32:27 +00:00
Matthew Heon b4420e22fc Fix a bug with hook ALWAYS matching with a process
When a non-nil process was used and a hook was set to match
always, this would not actually match. Fix this.

Fixes: #1308

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1311
Approved by: rhatdan
2018-08-22 11:48:43 +00:00
Daniel J Walsh 462c503a47 Fix handling of devices
Devices are supposed to be able to be passed in via the form of

--device /dev/foo
--device /dev/foo:/dev/bar
--device /dev/foo:rwm
--device /dev/foo:/dev/bar:rwm

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1299
Approved by: umohnani8
2018-08-20 13:42:07 +00:00
Giuseppe Scrivano 50afe5b031 podman: fix --uts=host
Do not set any hostname value in the OCI configuration when --uts=host
is used and the user didn't specify any value.  This prevents an error
from the OCI runtime as it cannot set the hostname without a new UTS
namespace.

Differently, the HOSTNAME environment variable is always set.  When
--uts=host is used, HOSTNAME gets the value from the host.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1280
Approved by: baude
2018-08-17 08:17:43 +00:00
haircommander c4fadaba6b Added helper function for libpod pod api calls
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1275
Approved by: mheon
2018-08-16 20:31:50 +00:00
haircommander 309a2a15ae CreatePod args now PodCreate structure
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1275
Approved by: mheon
2018-08-16 20:31:50 +00:00
haircommander a51eb1e70f Added reason to PodContainerError
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1275
Approved by: mheon
2018-08-16 20:31:50 +00:00
haircommander 8d5e0108d7 Change batchcontainer to shared
To better reflect it's usage: to share functions between podman and varlink.

Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1275
Approved by: mheon
2018-08-16 20:31:50 +00:00
haircommander 0059989783 Add Pod API to varlink.
Including: GetPod, StartPod, StopPod, RestartPod, KillPod, PausePod, UnpausePod, CreatePod, RemovePod, and InspectPod

Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1275
Approved by: mheon
2018-08-16 20:31:50 +00:00
Daniel J Walsh d20f3a5146 switch projectatomic to containers
Need to get some small changes into libpod to pull back into buildah
to complete buildah transition.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1270
Approved by: mheon
2018-08-16 17:12:36 +00:00
Giuseppe Scrivano c0abfaa7c3 Revert "spec: bind mount /sys only for rootless containers"
It breaks "podman  run --net=host --uidmap=0:1:70000 --gidmap=0:20000:70000 busybox echo hi"

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1285
Approved by: rhatdan
2018-08-16 16:02:32 +00:00
Qi Wang 1003df3444 Suport format param for varlink Commit
We need to pass the image format OCI or docker  in the varlink commit command.

Signed-off-by: Qi Wang <qiwan@redhat.com>

Closes: #1281
Approved by: mheon
2018-08-16 15:35:28 +00:00
Giuseppe Scrivano 0ddb42b4f7 spec: bind mount /sys only for rootless containers
root can always mount a new instance.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1279
Approved by: rhatdan
2018-08-15 15:30:15 +00:00
Daniel J Walsh cd7102a70e Fix handling of hostname in --net=host
Hostname should be set to the hosts hostname when network is none.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1274
Approved by: giuseppe
2018-08-15 11:38:18 +00:00
Valentin Rothberg 9563f31437 pkg/apparmor: use a pipe instead of a tmp file
Use a pipe instead of a temporary file to load the apparmor profile.
This change has a measurable speed improvement for apparmor users.

Signed-off-by: Valentin Rothberg <vrothberg@suse.com>

Closes: #1262
Approved by: mheon
2018-08-14 14:25:14 +00:00
Valentin Rothberg 973c9e6ba6 pkg/apparmor: move data under Linux/apparmor buildtags
Move all Linux-related data under the corresponding buildtags to reduce
the memory footprint and speed up compilation for non-apparmor builds.

Signed-off-by: Valentin Rothberg <vrothberg@suse.com>

Closes: #1262
Approved by: mheon
2018-08-14 14:25:14 +00:00
Valentin Rothberg 31e0dea5a0 pkg/apparmor: move all linux-code into apparmor_linux*
For easier maintenance and clearer structure of the code.

Signed-off-by: Valentin Rothberg <vrothberg@suse.com>

Closes: #1262
Approved by: mheon
2018-08-14 14:25:14 +00:00
baude 5d7b31da73 when searching, survive errors for multiple registries
when searching multiple registries for images, if we get an error on one
of the searches, we should keep going and complete the search.  if there
is only one search registry however, we will return an error.

Resolves: #1255

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

Closes: #1257
Approved by: mheon
2018-08-14 01:59:53 +00:00
Giuseppe Scrivano 9e06478d83 rootless: fix user lookup if USER= is not set
Lookup the current username by UID if the USER env variable is not
set.

Reported in: https://github.com/projectatomic/libpod/issues/1092

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1217
Approved by: rhatdan
2018-08-08 09:27:27 +00:00
baude bd9d3a8fa5 Rename varlink socket and interface
io.projectatomic.podman -> io.podman

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

Closes: #1204
Approved by: mheon
2018-08-06 14:49:11 +00:00
baude a1e3e542ff Make one runtime for the varlink service
Rather than making a runtime each time a client hits a varlink endpoint, we now
make a single runtime when the varlink service starts up.  This fixes a problem
where we hit a max inotify limit from CNI.

Resolves: #1211

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

Closes: #1215
Approved by: rhatdan
2018-08-05 10:43:32 +00:00
Anders F Björklund 71af51e723 Check for missing arguments in /proc/self/cmdline
Closes: #1206
Approved by: giuseppe
2018-08-03 07:39:25 +00:00
Giuseppe Scrivano 13b1845214 rootless: do not set setgroups to deny when using newuidmap
It is required only when directly configuring the user namespace.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1200
Approved by: rhatdan
2018-08-02 18:49:55 +00:00
Daniel J Walsh 9f2da6f59f
Merge pull request #1201 from giuseppe/fix-segfault-rootless
rootless: do not segfault if the parent already died
2018-08-02 14:42:39 -04:00
Giuseppe Scrivano c7b6403ae5
rootless: do not segfault if the parent already died
Closes: https://github.com/projectatomic/libpod/issues/1189

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-08-02 14:29:50 +02:00
Miloslav Trmač 4dab4d97de RFC: Rename Image.PushImage to Image.PushImageToHeuristicDestination
The goal is to be very explicit about which functions try to heuristically
guess what is the expected format of the string.  Not quite "shaming"
the users, but making sure they stand out.

RFC:
- Is this at all acceptable? Desirable?
- varlink ExportImage says "destination must have transport type";
  should it be using alltransports.ParseImageReference
  + PushImageToReference, then?

(While touching the call in cmd/podman, also remove a commented-out
older version of the call.)

Should not change behavior (but does not add unit tests).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Giuseppe Scrivano cfcd928476 network: add support for rootless network with slirp4netns
slirp4netns is required to setup the network namespace:

https://github.com/rootless-containers/slirp4netns

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1156
Approved by: rhatdan
2018-07-31 13:39:29 +00:00
baude 5b9c60cc10 varlink ImageRemove should always return image ID
When removing an image via varlink, we should always return the
ID of the image even in the case where the image has multiple
repository names and one was only untagged.

Reported by jhonce during integration testing.

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

Closes: #1191
Approved by: jwhonce
2018-07-31 11:38:48 +00:00
Matthew Heon 3dd577e93c Fix godoc comment in pkg/netns
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1165
Approved by: baude
2018-07-27 02:48:16 +00:00
Matthew Heon 8c52aa15f0 Fix handling of Linux network namespaces
The CNI plugins upstream removed their network namespace creation
code, making it a test package only. Copy it into our repository
and slightly modify it for our use (most notably, use MNT_DETACH
when unmounting namespaces).

This new CNI code splits closing and unmounting network
namespaces, which allows us to greatly reduce the number of
occasions on which we call teardownNetwork() and make more errors
in that function fatal instead of warnings. Instead, we can call
Close() and just close the open file descriptor in cases where
the namespace has already been cleaned up.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1165
Approved by: baude
2018-07-27 02:48:15 +00:00
umohnani8 e56717833e Clear variables used to store options after parsing for every volume
If more than one volume was mounted using the --volume flag in
podman run, the second and onwards volumes were picking up options
of the previous volume mounts defined. Found out that the options were
not be cleared out after every volume was parsed.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #1142
Approved by: mheon
2018-07-25 14:44:57 +00:00
Daniel J Walsh c90b7400a8
Merge pull request #1116 from mheon/namespaces
Add Pod and Container namespaces
2018-07-25 08:47:35 -04:00
Matthew Heon 561007d1f8
Merge pull request #1153 from jwhonce/bug/psgo
Fix varlink API usage of psgo
2018-07-24 18:23:41 -04:00
Giuseppe Scrivano e43270fc5e podman: allow to specify the IPC namespace to join
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1145
Approved by: rhatdan
2018-07-24 21:50:49 +00:00
Giuseppe Scrivano 977c8a9cd6 podman: allow to specify the UTS namespace to join
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1145
Approved by: rhatdan
2018-07-24 21:50:49 +00:00
Giuseppe Scrivano 8223fbaac6 podman: allow to specify the PID namespace to join
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1145
Approved by: rhatdan
2018-07-24 21:50:49 +00:00
Giuseppe Scrivano 819c807125 podman: allow to specify the userns to join
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1145
Approved by: rhatdan
2018-07-24 21:50:49 +00:00
Giuseppe Scrivano 41c7e43b4d network: support ns: prefix to join existing namespace
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1145
Approved by: rhatdan
2018-07-24 21:50:49 +00:00
Giuseppe Scrivano 6f65490e27 spec: allow container:NAME network mode
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1145
Approved by: rhatdan
2018-07-24 21:50:49 +00:00
Matthew Heon 486c5c87bc Add missing runtime.go lines to set namespace
Also add namespace to inspect output to verify its presence

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-07-24 16:12:31 -04:00
Jhon Honce 8e145d9c9a Fix varlink API usage of psgo
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-07-24 12:06:16 -07:00
Valentin Rothberg 8569ed0305 AppArmor: runtime check if it's enabled on the host
Check at runtime if AppArmor is enabled on the host.

Signed-off-by: Valentin Rothberg <vrothberg@suse.com>

Closes: #1128
Approved by: mheon
2018-07-23 18:11:09 +00:00
Giuseppe Scrivano d4f14be3a7
rootless: support a per-user mounts.conf
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-20 11:00:53 +02:00
Giuseppe Scrivano 45a92f8357
secrets: parse only one mounts configuration file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-20 11:00:53 +02:00
Giuseppe Scrivano c737d01937
rootless: allow a per-user registries.conf file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-20 11:00:52 +02:00
Giuseppe Scrivano 6372c977ea rootless: require subids to be present
Most images won't work without multiple ids/gids.  Error out
immediately if there are no multiple ids available.

The error code when the user is not present in /etc/sub{g,u}id looks
like:

$ bin/podman run --rm -ti alpine echo hello
ERRO[0000] No subuid ranges found for user "gscrivano"

Closes: https://github.com/projectatomic/libpod/issues/1087

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1097
Approved by: rhatdan
2018-07-16 13:40:40 +00:00
Matthew Heon 5b43a6a7ee Only print container size JSON if --size was requested
To do this, move it into a separate struct, and embed that in
the JSON we return.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-07-13 14:28:41 -04:00
Daniel J Walsh 14a6d51a84
Merge pull request #1091 from giuseppe/rootless-unshare-mount-ns
rootless: unshare mount namespace
2018-07-13 14:16:24 -04:00