Commit Graph

146 Commits

Author SHA1 Message Date
e178abd17a Merge pull request #5328 from crosbymichael/refactor-cgroups
Refactor cgroups into subsystems and support metrics
Upstream-commit: 781671245778c8cfdde1892204bb10899020b0d8
Component: engine
2014-04-21 14:06:17 -07:00
fec63c3950 Move raw cgroups into fs package (filesystem)
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 06db0604e5e5438dc14e13a069ebddcab7bb4bc6
Component: engine
2014-04-18 21:34:26 -07:00
91235494a6 Move systemd code into pkg
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: ec43ec50b44cff3f043c78cad97466c68e2ba8cd
Component: engine
2014-04-18 21:30:08 -07:00
0b62a2c5be Refactor cgroups file locations
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 42fb2973c690fe4e4f65da235ce4dfa4c388e8a3
Component: engine
2014-04-18 21:14:58 -07:00
ebb2ad0565 Move apparmor to top level pkg
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 052cc5a6378ee4bbe1ef79e5632e2439d68ddbde
Component: engine
2014-04-13 23:33:25 +00:00
b85f5791ad Use apparmor_parser directly
The current load script does alot of things.  If it does not find the
parser loaded on the system it will just exit 0 and not load the
profile.  We think it should fail loudly if it cannot load the profile
and apparmor is enabled on the system.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 5f4bc4f916f433a4ba258980a6c2fbdbd76d64f3
Component: engine
2014-04-13 23:31:10 +00:00
4ea377c1c7 Merge pull request #5143 from kzys/ns-nil
Avoid "invalid memory address or nil pointer dereference" panic
Upstream-commit: b8c10d8af254a6200de642e246b5a0d9de0dfca8
Component: engine
2014-04-10 11:07:35 -07:00
39bbc0e47b Merge pull request #5131 from crosbymichael/shm-mode
Change shm mode to 1777
Upstream-commit: 042a50a8fe1e54ce602d1c517091381c209eabf3
Component: engine
2014-04-10 07:50:32 -07:00
b4f2aeb444 Merge pull request #5115 from alexlarsson/fix-libcontainer-network-rhel6
Fix libcontainer network support on rhel6
Upstream-commit: 5b242c95da303ee26d3119678340050670fed45a
Component: engine
2014-04-10 07:45:12 -07:00
9a57be369c Avoid "invalid memory address or nil pointer dereference" panic
libcontainer.GetNamespace returns nil on FreeBSD because
libcontainer.namespaceList is empty. In this case, Namespaces#Get should
return nil instead of being panic.

Docker-DCO-1.1-Signed-off-by: Kato Kazuyoshi <kato.kazuyoshi@gmail.com> (github: kzys)
Upstream-commit: c5226d94fab4e261fe2407262d9b5177326d4062
Component: engine
2014-04-10 22:07:29 +09:00
7b99942ebd Fix libcontainer network support on rhel6
It seems that netlink in older kernels, including RHEL6, does not
support RTM_SETLINK with IFLA_MASTER. It just silently ignores it, reporting
no error, causing netlink.NetworkSetMaster() to not do anything yet
return no error.

We fix this by introducing and using AddToBridge() in a very similar manner
to CreateBridge(), which use the old ioctls directly.

This fixes https://github.com/dotcloud/docker/issues/4668

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 59c1b2880be8fb9d9a632fa42a10097c1580591a
Component: engine
2014-04-09 15:44:18 +02:00
855754fa1c Change shm mode to 1777
Fixes #5126
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 986cf931c38b8cdc51da44af0313502ca1156cfc
Component: engine
2014-04-09 10:53:32 +00:00
7d69f5cd99 Check for apparmor enabled on host to populate profile
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 87f0d63fb2ede63d263d8e8285b83a7f7d12bbf3
Component: engine
2014-04-09 10:22:17 +00:00
c2ee8e861a Backup current docker apparmor profile and replace it with the new one
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
Upstream-commit: 4f828d67f00449182eaada50dfba37e00f8f01ef
Component: engine
2014-04-08 11:09:31 -07:00
06d3bd0a02 Merge pull request #5049 from Supermathie/aa-fix
apparmor: docker-default: Include base abstraction
Upstream-commit: 8cfbc4466151666417a1245422ce0cb773d6d260
Component: engine
2014-04-07 21:34:01 -07:00
a8f5408909 Merge pull request #5025 from dstine/readme-fix
fixed two readme typos
Upstream-commit: 1d2126be6cf9937ee5ec2174aa2e2d02c07eb40c
Component: engine
2014-04-07 19:31:16 -07:00
9045165305 fixed three more typos
Upstream-commit: 9c4d10b9a91b9f11794ceb094331496c733410bb
Component: engine
2014-04-07 22:09:15 -04:00
ba83763b84 Ensure that ro mounts are remounted
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: b6042f252dd8a0c7a75da481b667f89c2e4ab071
Component: engine
2014-04-07 18:23:22 -07:00
22496306d5 apparmor: pull in variables from tunables/global
The variables that were defined at the top of the apparmor profile are best
pulled in via the <tunables/global> include.

Docker-DCO-1.1-Signed-off-by: Michael Brown <michael.brown@discourse.org> (github: Supermathie)
Upstream-commit: 726206f2aa45b8a537ae6d6c819f21befc2e0aca
Component: engine
2014-04-07 03:04:27 -04:00
ee2b8b0673 apparmor: abstractions/base expects pid variable
Add 'pid' variable pointing to 'self' to allow parsing of profile to succeed

Docker-DCO-1.1-Signed-off-by: Michael Brown <michael.brown@discourse.org> (github: Supermathie)
Upstream-commit: 320b3e0d211d389addda02998a0f47839827b2af
Component: engine
2014-04-07 02:47:43 -04:00
70e9ec0c23 apparmor: docker-default: Include base abstraction
Encountered problems on 14.04 relating to signals between container
processes being blocked by apparmor. The base abstraction contains
appropriate rules to allow this communication.

Docker-DCO-1.1-Signed-off-by: Michael Brown <michael.brown@discourse.org> (github: Supermathie)
Upstream-commit: e35c23311fce853fab318527789f11cc8c150ea2
Component: engine
2014-04-07 02:19:38 -04:00
435555c277 fixed two readme typos
Upstream-commit: bea71245c8165e0dfdc6b2485c548c04f4d3edd3
Component: engine
2014-04-04 08:12:17 -04:00
f11e4187aa Remove loopback setup for native driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 18ef3cc24a933cbf403c2aaf8b374cfc84a722a4
Component: engine
2014-04-02 13:12:52 +00:00
c93b9fc839 Merge pull request #4953 from rhatdan/selinux
These two patches should fix problems we see with running docker in the wild.
Upstream-commit: 9687c087ab09feb106b040628423e70b320a51e2
Component: engine
2014-04-02 16:36:41 -07:00
4675670b52 Merge pull request #4867 from crosbymichael/clean-shutdown
Cleanly shutdown docker
Upstream-commit: 30ff3fa954676bfc8f48b73093f3afa1473d146e
Component: engine
2014-04-02 01:48:03 +03:00
55905d7fbc Merge pull request #4942 from vieux/cleanup_dev_libcontainer
remove setupDev from libcontainer
Upstream-commit: 9cf89f854256eace2b8f446b16c4fbe22ffa61b1
Component: engine
2014-04-01 14:28:17 -07:00
94c4d19652 In certain cases, setting the process label will not happen.
When the code attempts to set the ProcessLabel, it checks if SELinux Is
enabled.  We have seen a case with some of our patches where the code
is fooled by the container to think that SELinux is not enabled.  Calling
label.Init before setting up the rest of the container, tells the library that
SELinux is enabled and everything works fine.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
Upstream-commit: 2224e0d65adfbd08e53430a1d7c750491f788257
Component: engine
2014-04-01 13:30:10 -04:00
d0b2920666 Don't send prctl to be consistent with other drivers
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 283daced0c919be760947d44d7e46c80e1054d64
Component: engine
2014-04-01 07:12:50 +00:00
5f13c09028 Ensure a reliable way to kill ghost containers on reboot
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 5bb82f6313d7f789783ffac854be85a44a56617e
Component: engine
2014-04-01 07:11:41 +00:00
5505d168ef remove setupDev from libcontainer
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
Upstream-commit: d52d24dd801f3ffe1b894226b8dba613de59bd87
Component: engine
2014-04-01 00:28:44 +00:00
4a0326289d cgroups: Splity out Apply/Cleanup to separate file/interface
This leaves only the generic cgroup helper functions in cgroups.go and
will allow easy implementations of other cgroup managers.

This also wires up the call to Cleanup the cgroup which was missing
before.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 7f7d8419a71d49b25e4d38196b36e93b568bb61d
Component: engine
2014-03-27 21:47:47 +01:00
f4111a1ccb Merge branch 'master' into pluginflag
Conflicts:
	pkg/cgroups/cgroups.go
	pkg/libcontainer/nsinit/exec.go
	pkg/libcontainer/nsinit/init.go
	pkg/libcontainer/nsinit/mount.go
	runconfig/hostconfig.go
	runconfig/parse.go
	runtime/execdriver/driver.go
	runtime/execdriver/lxc/lxc_template.go
	runtime/execdriver/lxc/lxc_template_unit_test.go
	runtime/execdriver/native/default_template.go
	runtime/execdriver/native/driver.go

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: eab56ac007b263708b5526609c8be2bc19881467
Component: engine
2014-03-27 08:00:18 +00:00
f757666ccd This patch adds SELinux labeling support.
docker will run the process(es) within the container with an SELinux label and will label
all of  the content within the container with mount label.  Any temporary file systems
created within the container need to be mounted with the same mount label.

The user can override the process label by specifying

-Z With a string of space separated options.

-Z "user=unconfined_u role=unconfined_r type=unconfined_t level=s0"

Would cause the process label to run with unconfined_u:unconfined_r:unconfined_t:s0"

By default the processes will run execute within the container as svirt_lxc_net_t.
All of the content in the container as svirt_sandbox_file_t.

The process mcs level is based of the PID of the docker process that is creating the container.

If you run the container in --priv mode, the labeling will be disabled.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
Upstream-commit: 4c4356692580afb3971094e322aea64abe0e2500
Component: engine
2014-03-26 15:30:40 -04:00
9fad5483e0 Change placement of readonly filesystem
We need to change it to read only at the very end so that bound,
copy dev nodes and other ops do not fail.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 2c58a1e2886433a4266615b1f492f829e7a6f53f
Component: engine
2014-03-21 14:17:17 +00:00
ffa18d8ad0 Allow containers to join the net namespace of other conatiners
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: be5538d8a8820ac1192c7a5660e0d950927b42d0
Component: engine
2014-03-21 00:48:17 +00:00
b80ed35d06 Merge branch 'proppy-nsinit' into pluginflag
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 1bedae9107108156d6d272494f1ff27d8b4be590
Component: engine
2014-03-21 00:36:23 +00:00
c42d40863c Add ability to work with individual namespaces
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 70f3b9f4ce67ee54ec226814cdd26db01f69378d
Component: engine
2014-03-21 00:23:34 +00:00
44fe86670a Allow caps to be toggled in native driver with plugin flag
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 443a75d5f66e986e9d7740d3f2aaef080aef8ea0
Component: engine
2014-03-21 00:10:24 +00:00
3490f03690 Dont use custom marshaling for caps and namespaces
This also adds an enabled field to the types so that they
can be easily toggled.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: c5f9c4bd6933c806490e4f7cb52557cee154dbed
Component: engine
2014-03-20 23:09:01 +00:00
433a941c61 libcontainer: remove duplicate imports
Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
Upstream-commit: 5dbfe310fe624c66714f8c5017692f528af4c87f
Component: engine
2014-03-18 16:25:26 -07:00
bf68195445 libcontainer: goimports
Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
Upstream-commit: f58757a699cf47c3b8770e13f371e1bbf493b5b1
Component: engine
2014-03-18 16:18:34 -07:00
05b01b0f64 libcontainer/nsinit/init: move mount namespace after network
Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
Upstream-commit: b10b950b110c93db34a399753706dc79c71b94d3
Component: engine
2014-03-18 16:18:04 -07:00
c37f607a5b libcontainer/network: add netns strategy
Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
Upstream-commit: f52b2fdcbb29258c5b492fdb2479d473fcb42ca0
Component: engine
2014-03-18 16:17:28 -07:00
2d58b8bf60 Only unshare the mount namespace for execin
Fixes #4728
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 4b1513f9c394fbfdf21998db4318251b4e8b6bc0
Component: engine
2014-03-17 18:52:56 -07:00
ccebbeffe2 Fix issue #4681 - No loopback interface within container when networking is disabled.
Docker-DCO-1.1-Signed-off-by: Timothy Hobbs <timothyhobbs@seznam.cz> (github: https://github.com/timthelion)

Remove loopback code from veth strategy

Docker-DCO-1.1-Signed-off-by: Timothy Hobbs <timothyhobbs@seznam.cz> (github: https://github.com/timthelion)

Looback strategy: Get rid of uneeded code in Create
Docker-DCO-1.1-Signed-off-by: Timothy Hobbs <timothyhobbs@seznam.cz> (github: https://github.com/timthelion)

Use append when building network strategy list

Docker-DCO-1.1-Signed-off-by: Timothy Hobbs <timothyhobbs@seznam.cz> (github: https://github.com/timthelion)

Swap loopback and veth strategies in Networks list

Docker-DCO-1.1-Signed-off-by: Timothy Hobbs <timothyhobbs@seznam.cz> (github: https://github.com/timthelion)

Revert "Swap loopback and veth strategies in Networks list"

This reverts commit 3b8b2c8454171d79bed5e9a80165172617e92fc7.

Docker-DCO-1.1-Signed-off-by: Timothy Hobbs <timothyhobbs@seznam.cz> (github: https://github.com/timthelion)

When initializing networks, only return from the loop if there is an error

Docker-DCO-1.1-Signed-off-by: Timothy Hobbs <timothyhobbs@seznam.cz> (github: https://github.com/timthelion)
Upstream-commit: 353df19ab7009f6555dee506841ae0b690a08768
Component: engine
2014-03-17 22:01:24 +01:00
4ff432cad1 Merge pull request #4645 from crosbymichael/add-logger
Add logger to libcontainer
Upstream-commit: 597e0812fb8a40cf73388bcc44e6be74035a9846
Component: engine
2014-03-17 11:30:14 -07:00
b1507c6b21 chore(libcontainer): small grammar fix in types_test
Someone probably got really used to typing er on the end of contain :)

Docker-DCO-1.1-Signed-off-by: Brandon Philips <brandon.philips@coreos.com> (github: philips)
Upstream-commit: ad7e7d612390d09d3a54fd82dda9687deb3b0cbe
Component: engine
2014-03-17 11:07:29 -07:00
ba77c9041d refactor(libcontainer): rename to CapabilitiesMask
The Capabilities field on libcontainer is actually used as a mask.
Rename the field so that this is more clear.

Docker-DCO-1.1-Signed-off-by: Brandon Philips <brandon.philips@coreos.com> (github: philips)
Upstream-commit: 128381e0f0372f10f88a847087aa91a972770c4b
Component: engine
2014-03-17 11:07:12 -07:00
842270ca38 Send sigterm to child instead of sigkill
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 39037a91f85a4a072e5aa7e585d8c2f6b211df8a
Component: engine
2014-03-14 15:42:05 -07:00
0d0170bb11 Add stderr log ouput if in debug
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 0e863a584a6edfa1c3ec383c586b646663b66bc7
Component: engine
2014-03-14 09:55:05 -07:00