Commit graph

69 commits

Author SHA1 Message Date
Daniel J Walsh 57a8c2e5e8
Mount proper cgroup for systemd to manage inside of the container.
We are still requiring oci-systemd-hook to be installed in order to run
systemd within a container.  This patch properly mounts

/sys/fs/cgroup/systemd/libpod_parent/libpod-UUID on /sys/fs/cgroup/systemd inside of container.

Since we need the UUID of the container, we needed to move Systemd to be a config option of the
container.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-10-15 16:19:11 -04:00
OpenShift Merge Robot 5f6e4cc830
Merge pull request #1605 from mheon/syslog_cleanup
Pass along syslog variable to podman cleanup processes
2018-10-11 11:49:45 -07:00
Matthew Heon f87f0abb77 Pass along syslog variable to podman cleanup processes
As of now, there is no way to debug podman clean up processes.
They are started by conmon with no stdout/stderr and log nowhere.
This allows us to actually figure out what is going on when a
cleanup process runs.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-10-11 13:19:39 -04:00
Matthew Heon 4882a6dd9d Add --ip flag and plumbing into libpod
Add the --ip flag back with bash completions. Manpages still
missing.

Add plumbing to pass appropriate the appropriate option down to
libpod to connect the flag to backend logic added in the previous
commits.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-10-11 11:24:08 -04:00
OpenShift Merge Robot 3c31e176c7
Merge pull request #1557 from rhatdan/systemd
Don't tmpcopyup on systemd cgroup
2018-10-04 09:54:51 -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
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
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 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
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
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
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 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
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 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
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
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
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
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 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
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
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
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
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
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
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
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
haircommander a04a8d1dd4 Added full podman pod ps, with tests and man page
Signed-off-by: haircommander <pehunt@redhat.com>
2018-07-13 09:17:33 -04:00
haircommander 1aad3fd96b Podman pod create/rm commands with man page and tests.
Includes a very stripped down version of podman pod ps, just for testing

Signed-off-by: haircommander <pehunt@redhat.com>
2018-07-13 09:05:03 -04:00
baude 4f699db8da Support multiple networks
This is a refresh of Dan William's PR #974 with a rebase and proper
vendoring of ocicni and containernetworking/cni.  It adds the ability
to define multiple networks as so:

podman run --network=net1,net2,foobar ...

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

Closes: #1082
Approved by: baude
2018-07-12 21:45:47 +00:00
umohnani8 4855998f1c Add --volumes-from flag to podman run and create
podman now supports --volumes-from flag, which allows users
to add all the volumes an existing container has to a new one.

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

Closes: #931
Approved by: mheon
2018-07-09 19:30:03 +00:00
Daniel J Walsh 5a8e5a2b17 Mask /proc/keys to protect information leak about keys on host
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1060
Approved by: mheon
2018-07-08 13:38:20 +00:00
Daniel J Walsh aaab26fd0c Block use of /proc/acpi from inside containers
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1053
Approved by: mheon
2018-07-06 17:29:35 +00:00