Commit Graph

239 Commits

Author SHA1 Message Date
3391df1350 Added stats.go which provides strong types for all stats that will be exported by libcontainer. This commit only introduces the strong type.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
Upstream-commit: 321b457044f287435780274bef0b4a65231892bc
Component: engine
2014-05-23 20:42:43 +00:00
258b16035a Merge pull request #5995 from vieux/recur_nodes
Add device nodes recursively
Upstream-commit: 3d78c49aab0829e6c3bcf63b2d7b2d162d11a11e
Component: engine
2014-05-22 16:35:27 -07:00
cb5e9c4323 update test
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Upstream-commit: b6c65df093111072bb44d42d650b591adb1bbbe0
Component: engine
2014-05-22 22:50:41 +00:00
e0f1623f01 add recursive device nodes
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Upstream-commit: 0abb52c7a97940dc17c45ac45226af8156d0e712
Component: engine
2014-05-22 22:29:13 +00:00
c13069d05f Make all cgroup stats output int64s instead of float64.
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
Upstream-commit: 4a33a757d540acd059ac957542527d641548e2cf
Component: engine
2014-05-22 20:53:36 +00:00
f41d7794be Merge pull request #5976 from crosbymichael/getpids
Move get pid into cgroup implementation
Upstream-commit: 55d41c3e21e1593b944c06196ffb2ac57ab7f653
Component: engine
2014-05-21 19:09:50 -07:00
69fad1b67f Merge pull request #5922 from crosbymichael/host-dev-priv
Mount /dev in tmpfs for privileged containers
Upstream-commit: 5a0a03e3942651a07858c278c4b40a0ead50eccb
Component: engine
2014-05-21 18:56:24 -07:00
189f43a3ba Move get pid into cgroup implementation
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 811d93326bc2d9451eb444e2343bb3063611de7a
Component: engine
2014-05-21 21:14:07 +00:00
d2e4e6b069 Revert "Always mount a /run tmpfs in the container"
This reverts commit 905795ece624675abe2ec2622b0bbafdb9d7f44c.

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: 8e967fe8028d8362fe3dfb293a8e07a959a4dd7f
Component: engine
2014-05-21 14:28:19 -06:00
37f08c7066 Update code post codereview
Add specific types for Required and Optional DeviceNodes
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: f042c3c15759fce5cc139f2b3362b791ac7d4829
Component: engine
2014-05-21 00:40:41 +00:00
34fdbfe296 Update documentation for container struct in libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: ed5892ed4efa995950e2fdeb5fd718b3bb1aa1c2
Component: engine
2014-05-20 23:34:46 +00:00
ada6c057b6 Mount /dev in tmpfs for privileged containers
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 34c05c58c8d41ee2bb02cd8059e9928ee2f061ea
Component: engine
2014-05-20 22:51:24 +00:00
d043d726b2 cgroups: Allow mknod for any device in systemd cgroup backend
Without this any container startup fails:
2014/05/20 09:20:36 setup mount namespace copy additional dev nodes mknod fuse operation not permitted

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 602950435056baa939f428223b6d3ff26ca5403d
Component: engine
2014-05-20 09:29:32 +02:00
9b9e25f1db Make sure dev/fuse is created in container
Fixes #5849

If the host system does not have fuse enabled in the kernel config we
will ignore the is not exist errors when trying to copy the device node
from the host system into the container.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: a87bcefb8bf0cee47bf114a46fc33708ce843208
Component: engine
2014-05-19 20:46:59 +00:00
4bebb62399 Merge pull request #5903 from alexlarsson/writable-proc
Make /proc writable, but not /proc/sys and /proc/sysrq-trigger
Upstream-commit: 30bd2bbc83b746a1d4527a5c57363bcb9bab34d6
Component: engine
2014-05-19 12:21:15 -07:00
c117ccdc5a Make /proc writable, but not /proc/sys and /proc/sysrq-trigger
Some applications want to write to /proc. For instance:

docker run -it centos groupadd foo

Gives: groupadd: failure while writing changes to /etc/group

And strace reveals why:

open("/proc/self/task/13/attr/fscreate", O_RDWR) = -1 EROFS (Read-only file system)

I've looked at what other systems do, and systemd-nspawn makes /proc read-write
and /proc/sys readonly, while lxc allows "proc:mixed" which does the same,
plus it makes /proc/sysrq-trigger also readonly.

The later seems like a prudent idea, so we follows lxc proc:mixed.
Additionally we make /proc/irq and /proc/bus, as these seem to let
you control various hardware things.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 68493e2f7f9cb8303302e1098e3293b521ace243
Component: engine
2014-05-19 20:46:05 +02:00
adb5b13fc3 Merge pull request #5792 from bernerdschaefer/nsinit-supports-pdeathsig
Add PDEATHSIG support to nsinit library
Upstream-commit: cb7680b9b919fdc845a857fafc52178c656cf5be
Component: engine
2014-05-19 11:13:23 -07:00
f3abdf9b7d Add the rest of the caps so that they are retained in privilged mode
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: e1c7abe8905d4cc034f1ed49e9d102846e412424
Component: engine
2014-05-19 16:43:31 +00:00
cc28bc2288 add support for CAP_FOWNER
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Upstream-commit: a0070f0c17b4f65bdfc5368b93d0fa8636eda03d
Component: engine
2014-05-17 01:16:07 +00:00
e3742d2641 Make libcontainer's CapabilitiesMask into a []string (Capabilities).
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
Upstream-commit: 92614928cecd48b241011e614fa856c4fdbac1f6
Component: engine
2014-05-17 00:44:10 +00:00
538811ef9a Merge pull request #5833 from ActiveState/fix_nsinit_env_panic
fix panic when passing empty environment
Upstream-commit: 62c3183fc88779479905df8c2f7561c46a08d2ee
Component: engine
2014-05-16 12:03:26 -07:00
919aaa7d95 fix panic when passing empty environment
Docker-DCO-1.1-Signed-off-by: Sridhar Ratnakumar <github@srid.name> (github: srid)
Upstream-commit: d787f2731e4242f244e88f047032ad9650f1f8d7
Component: engine
2014-05-16 11:55:34 -07:00
25e8afd42a Merge pull request #5810 from vmarmol/drop-caps
Change libcontainer to drop all capabilities by default.
Upstream-commit: 01d10d6f13d62d74f850fea2a685b24b7983244e
Component: engine
2014-05-16 11:51:41 -07:00
0b78fad0c6 nsinit.DefaultCreateCommand sets Pdeathsig to SIGKILL
Docker-DCO-1.1-Signed-off-by: Bernerd Schaefer <bj.schaefer@gmail.com> (github: bernerdschaefer)
Upstream-commit: 6a1d76bc7bc589b53530c03720022f0095b65d55
Component: engine
2014-05-16 13:48:41 +02:00
da3598172a nsinit.Init() restores parent death signal before exec
Docker-DCO-1.1-Signed-off-by: Bernerd Schaefer <bj.schaefer@gmail.com> (github: bernerdschaefer)
Upstream-commit: 00e1adfeada87100e5e88707309bcdcd674082d6
Component: engine
2014-05-16 13:48:41 +02:00
48bd5989f0 Change libcontainer to drop all capabilities by default. Only keeps
those that were specified in the config. This commit also explicitly
adds a set of capabilities that we were silently not dropping and were
assumed by the tests.

Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
Upstream-commit: 9d6875d19d3926faf6287487234ad0b2f1310e9d
Component: engine
2014-05-16 00:57:58 +00:00
1aafe01162 Remove the cgroups maintainer file
We don't need this because it is covered by the libcontainer MAINTAINERS
file
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: b22d10e3c541c46cebe7da44fd2f521c4bc653f4
Component: engine
2014-05-14 16:01:45 -07:00
910f9d50e2 Move cgroups package into libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 3b7a19def609c8fbadc6559e7f47f8a5a7769a5b
Component: engine
2014-05-14 15:21:44 -07:00
66a02eb50b Setup standard /dev symlinks
After copying allowed device nodes, set up "/dev/fd", "/dev/stdin",
"/dev/stdout", and "/dev/stderr" symlinks.

Docker-DCO-1.1-Signed-off-by: Bernerd Schaefer <bj.schaefer@gmail.com> (github: bernerdschaefer)
[rebased by @crosbymichael]
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 2bc34036b9106318f8564ee36b696ad070b02573
Component: engine
2014-05-14 13:59:13 -07:00
ffbe025292 Merge pull request #5791 from bernerdschaefer/nsinit-exec-forwards-signals
"nsinit exec ..." forwards signals to container
Upstream-commit: 432e42e7154ddc97e57783778a02edb5a95bfaa0
Component: engine
2014-05-14 11:05:27 -07:00
1bdce7b716 Merge pull request #5781 from creack/remove_bind_console
Remove the bind mount for dev/console which override the mknod/label
Upstream-commit: 3bf1b562e39bed0a4ecdad9b23c6274b80bdc82d
Component: engine
2014-05-14 10:57:21 -07:00
64ee7b470d "nsinit exec ..." forwards signals to container
Docker-DCO-1.1-Signed-off-by: Bernerd Schaefer <bj.schaefer@gmail.com> (github: bernerdschaefer)
Upstream-commit: 830c2d7fa3f19a2fba50464273ae19cd2113e689
Component: engine
2014-05-14 11:01:02 +02:00
435045ce97 Remove the bind mount for dev/console which override the mknod/label
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
Upstream-commit: ae85dd54582e94d36b146ab1688844ed58cc8df3
Component: engine
2014-05-13 11:59:27 -07:00
740073112a Update code to handle new path to Follow Symlink func
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: ca040b1a377c467a9504ffa256ae77d9e3d29f0c
Component: engine
2014-05-13 10:54:08 -07:00
23ad200555 libcontainer: Ensure bind mount target files are inside rootfs
Before we create any files to bind-mount on, make sure they are
inside the container rootfs, handling for instance absolute symbolic
links inside the container.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: b7c7b851dce28bb679e0289168da382d7cdad74b
Component: engine
2014-05-13 10:24:52 -07:00
23c5da98b4 Always mount a /run tmpfs in the container
All modern distros set up /run to be a tmpfs, see for instance:
https://wiki.debian.org/ReleaseGoals/RunDirectory

Its a very useful place to store pid-files, sockets and other things
that only live at runtime and that should not be stored in the image.

This is also useful when running systemd inside a container, as it
will try to mount /run if not already mounted, which will fail for
non-privileged container.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 905795ece624675abe2ec2622b0bbafdb9d7f44c
Component: engine
2014-05-12 21:41:04 +02:00
ed72957edf Merge pull request #5748 from crosbymichael/libcontainer-bindmounts
libcontainer: Create dirs/files as needed for bind mounts
Upstream-commit: 30a40de205c6c29ae8e2379c39d69186ef04bf6e
Component: engine
2014-05-12 12:27:18 -07:00
fba87d75f1 Remove newline char in error message
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: cc678a7078b417a330e8d4e3604b74f9e5d4cda4
Component: engine
2014-05-12 12:24:30 -07:00
616f1c2db1 Correct a comment in libcontainer Mount Namespace setup.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
Upstream-commit: fee1bbd79ef8767ed149c1b1af4a39ad35e07772
Component: engine
2014-05-12 19:01:36 +00:00
9844c82806 libcontainer: Create dirs/files as needed for bind mounts
If you specify a bind mount in a place that doesn't have a file yet we
create that (and parent directories). This is needed because otherwise
you can't use volumes like e.g. /dev/log, as that gets covered by the
/dev tmpfs mounts.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 70ef53f25e177e42046170ef59bb29ebd77a3016
Component: engine
2014-05-12 09:57:15 +02:00
71620ac1c0 Update restrict.Restrict to both show the error message when failing to mount /dev/null over /proc/kcore, and to ignore "not exists" errors while doing so (for when CONFIG_PROC_KCORE=n in the kernel)
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: d60301edb88a4e182a10cd2becb3795b2dd13fab
Component: engine
2014-05-08 01:03:45 -06:00
8376ec5af9 Merge pull request #5630 from rjnagal/libcontainer-fixes
Check supplied hostname before using it.
Upstream-commit: 818648ff9f9e506e2d296fb73ef55dc8f87648fb
Component: engine
2014-05-06 09:49:52 -07:00
41f42a620b Improve libcontainer namespace and cap format
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: db5f6b4aa0b34adbc9ba189a042e77e7bcdee681
Component: engine
2014-05-05 12:34:21 -07:00
d6e1c1cb2b Check supplied hostname before using it.
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
Upstream-commit: 412324cfbe9b5e256d9af31b21e6ae142d39612c
Component: engine
2014-05-05 18:12:25 +00:00
f69322b472 Merge pull request #5556 from crosbymichael/no-restrict-lxc
Don't restrict lxc because of apparmor
Upstream-commit: 3a1f0dedc71712403c591dd9e552f7a906c2e4ea
Component: engine
2014-05-02 17:20:27 -07:00
ac76593583 Month devpts before mounting subdirs
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
Upstream-commit: a7ccbfd5f143af8a7accc69803b1588e568328ac
Component: engine
2014-05-02 13:55:45 -07:00
1ed0224965 Don't restrict lxc because of apparmor
We don't have the flexibility to do extra things with lxc because it is
a black box and most fo the magic happens before we get a chance to
interact with it in dockerinit.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 59fe77bfa638001cbe9af386f350d6e0dbb23398
Component: engine
2014-05-02 11:14:24 -07:00
4d667fa77e Merge pull request #5529 from crosbymichael/restrict-proc
Mount /proc and /sys read-only, except in privileged containers
Upstream-commit: 1c5a3123cc6ac396656b1027504748bd8dcd65e9
Component: engine
2014-05-02 10:52:53 -07:00
6e316a7be9 Apply apparmor before restrictions
There is not need for the remount hack, we use aa_change_onexec so the
apparmor profile is not applied until we exec the users app.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 76fa7d588adfe644824d9a00dafce2d2991a7013
Component: engine
2014-05-01 19:09:12 -07:00
634dd08b53 Adding Rohit Jnagal and Victor Marmol to pkg/libcontainer maintainers.
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
Upstream-commit: 71e3757174c3c1617d636ddd7462c39617ba5a77
Component: engine
2014-05-01 15:51:38 -07:00