Commit Graph

68 Commits

Author SHA1 Message Date
746b307c72 Move all bind-mounts in the container inside the namespace
This moves the bind mounts like /.dockerinit, /etc/hostname, volumes,
etc into the container namespace, by setting them up using lxc.

This is useful to avoid littering the global namespace with a lot of
mounts that are internal to each container and are not generally
needed on the outside. In particular, it seems that having a lot of
mounts is problematic wrt scaling to a lot of containers on systems
where the root filesystem is mounted --rshared.

Note that the "private" option is only supported by the native driver, as
lxc doesn't support setting this. This is not a huge problem, but it does
mean that some mounts are unnecessarily shared inside the container if you're
using the lxc driver.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 6c266c4b42eeabe2d433a994753d86637fe52a0b
Component: engine
2014-03-13 20:01:29 +01:00
1cf50c0291 Move .dockerenv parsing to lxc driver
This is not needed for e.g. the native driver

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 636959e20ae368e470a5c2420aae4528245b2cf6
Component: engine
2014-03-13 20:01:29 +01:00
909b6bf3f3 Update parseLxcInfo to comply with new lxc1.0 format
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
Upstream-commit: fd0737df2c8ec8f0a4b4d8f20b2ad6e4c96adbd3
Component: engine
2014-03-11 12:08:32 -07:00
4be803250c Remove goroutine leak upon error
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
Upstream-commit: 721562f29685ebf3f3698113cf0ce8000c02e606
Component: engine
2014-03-11 11:39:28 -07:00
fe7e822dde Merge pull request #4509 from crosbymichael/kill-all
Remove the ghosts and kill everything
Upstream-commit: 1695c77c436e65a9f553b365714b56f78891bef5
Component: engine
2014-03-07 01:35:38 +02:00
936f96cce5 Remove the ghosts and kill everything
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 772ef99d2816b629d084e11fe7fba5953687b620
Component: engine
2014-03-06 15:30:26 -08:00
e217c314a6 Return correct process pid for lxc
Fixes #2875
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 69e3d30bb6c5082aff2a7d5eafaf562e59246a49
Component: engine
2014-03-05 18:02:19 -08:00
efaa1f688a fix docker info with lxc 1.0.0
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
Upstream-commit: f30f823bf50de6581f547aee842286584c4b6990
Component: engine
2014-02-28 00:32:58 +00:00
c5ba66b375 Merge pull request #4282 from ibuildthecloud/jumbo-frames
Add MTU to lxc conf to make host and container MTU match
Upstream-commit: 22da8cdc7e862dbc54806dc935f4ef079be22654
Component: engine
2014-02-26 20:11:38 +02:00
360444d431 Merge pull request #4308 from vbatts/vbatts-seperate_driver_term
seperate out the terminal functions from lxc
Upstream-commit: d8b60cb5929b35d35695708ffb8595bc55d2b37f
Component: engine
2014-02-26 16:58:21 +02:00
fbca607ce0 correcting the package name for the terminal setup
Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
Upstream-commit: c35853191ccd9ca8fe91b666d598eac3e4e12c67
Component: engine
2014-02-25 10:07:06 -05:00
8a923765fc Use the cpu cgroup subsystem instead of memory because its non optional
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 757c7581c8334b6b527d1c922fe5007d5004eca2
Component: engine
2014-02-24 13:42:13 -08:00
d6c00b381a seperate out the terminal functions from lxc to the pkg/term
Since these functions are indepenent of lxc, and could be used by
  other drivers.

Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
Upstream-commit: de848a14caf1636cc24e621a35d7073cebe5444d
Component: engine
2014-02-24 13:42:09 -05:00
28cc135001 Move current tty and pipe impl to lxc driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: aac702727ea02b3974a2848748b0713ac583fc84
Component: engine
2014-02-21 13:27:34 -08:00
b0992a0e99 Move term creation into driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 592c2f6f9a472bda227a03c819f73b8edc7c3320
Component: engine
2014-02-21 12:42:37 -08:00
a808fdbf65 Change Console to Terminal
Move creation and attach to driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 1e742876988546efb876f67f83de6737ee5e9cf6
Component: engine
2014-02-21 12:32:14 -08:00
9b049ad74b Add MTU to lxc conf to make host and container MTU match
If you are using jumbo frames the host side of the veth was being set to
1500.  Docker would set the MTU of the container side of the veth to 9001.
This would lead to a situation in which the two sides of the veth had
different MTU sizes causing issues in network traffic.

Docker-DCO-1.1-Signed-off-by: Darren Shepherd <darren.s.shepherd@gmail.com> (github: ibuildthecloud)
Upstream-commit: 0db53bd2ecba097c6ace1a1088e11458e139390a
Component: engine
2014-02-21 03:02:06 -07:00
a7d9996138 Cleanup some statements from exec driver work
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 9e3da87a3a6fea21194ceb9dbd30a39d043a48a4
Component: engine
2014-02-14 17:28:50 -08:00
3dbd63bc33 Mount-bind the PTY as container console - allow for tmux/screen to run
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Upstream-commit: 408ea0771a9cb3046b8e484dcfefe5233fcbb27a
Component: engine
2014-02-13 17:23:09 -08:00
750f4cb5c2 Merge pull request #4059 from alexlarsson/no-netadmin-caps
lxc: Drop NET_ADMIN capability in non-privileged containers
Upstream-commit: 3c215ba41005f225a07ebc8806216acdb746c671
Component: engine
2014-02-11 14:20:34 -05:00
96a42d5055 lxc: Drop NET_ADMIN capability in non-privileged containers
With this capability set the container can e.g. change the ip address
of his devices to that of another container on the docker0 bridge. In
a quick test I was able to listen to a port on a different ip than the
one docker assigned me, but was not able to hijack an open port
redirection that another container had open. Maybe its possible with
some more knowledge of networking though.

Anyway, network setup is meant to be handled by docker, not the apps,
so I believe denying this is generally in the spirit of docker, and
it closes down potential security issues.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 02fddffd51da782f912e2709ea814c330269515b
Component: engine
2014-02-11 11:17:34 +01:00
3665663666 Merge pull request #3524 from tianon/supplementary-groups
Add supplementary groups lookup in sysinit
Upstream-commit: 2dcb48af0fa9bba2fb47b08dd2c9747acf09ea44
Component: engine
2014-02-10 14:42:14 -08:00
79c6233460 Merge pull request #3871 from jdef/patch-1
Update lxc_template.go
Upstream-commit: 036900a63adf9621c4e0f4c162f89da2f4171453
Component: engine
2014-02-10 14:38:39 -08:00
29b4f1c123 Remove panic in lxc driver.
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Upstream-commit: 7c06d5e34e2ebf5006ce3a34438f18c071153e97
Component: engine
2014-02-07 19:09:52 -08:00
c7f0c458df Update lxc_template.go
If networking is disabled, but then pipework is used later to add nics, the network still doesn't function. Using flags=up for empty networking fixes this.
Docker-DCO-1.1-Signed-off-by: James DeFelice <james.defelice@ishisystems.com> (github: jdef)
Upstream-commit: 17c124baf6a0f3725615b22aa52ca96ac5b95326
Component: engine
2014-02-03 16:14:15 -05:00
1ed42315f3 Move UserLookup functionality into a separate pkg/user submodule that implements proper parsing of /etc/passwd and /etc/group, and use that to add support for "docker run -u user:group" and for getting supplementary groups (if ":group" is not specified)
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: ee93f6185be3ae73c16cf41ae397bae3ce2f6c55
Component: engine
2014-01-31 20:15:24 -07:00
df82456ed9 Merge pull request #3857 from creack/remove_darwin_files
Remove all darwin specific files and use more generic _unsupported with build tags.
Upstream-commit: 523341d994265b9f72e4869f0fd094fd15f1b480
Component: engine
2014-01-31 11:48:10 -08:00
db540896bd Merge pull request #3844 from clkao/lxc-kill-deprecation
Use lxc-stop -k instead of lxc-kill
Upstream-commit: f267938fb8db682eb34a9c221a1b8c2288995206
Component: engine
2014-01-31 10:57:40 -08:00
e8f6d5eb59 Update/fix build tags, Dockerfile, and release.sh for proper building and releasing of linux/386 and linux/arm cross-compiled client binaries
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: 065dd231dd7d7858df982a8decfade9df936cf63
Component: engine
2014-01-31 03:16:42 -07:00
185286d85e Remove all darwin specific files and use more generic _unsupported with build tags.
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Upstream-commit: 45dd051e8ee2e0e18d8ffec99f65878c20bd11e9
Component: engine
2014-01-30 23:10:56 +00:00
38ee88c4ce fix TestExitCode
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
Upstream-commit: 720f64af1855235b6f518ad97dbb89eb61191222
Component: engine
2014-01-30 22:59:21 +00:00
113400b4e9 Use lxc-stop -k when lxc-kill is not found
lxc-kill was removed in lxc/lxc@33ddfc2

Docker-DCO-1.1-Signed-off-by: Chia-liang Kao <clkao@clkao.org> (github: clkao)
Upstream-commit: b111fc364611d755ac791c5c51c82c5754fe545b
Component: engine
2014-01-31 03:22:22 +08:00
87c7be2925 Merge pull request #3808 from alexlarsson/execdriver-get-pids-for-container
execdriver: Make GetPidsForContainer() a driver call
Upstream-commit: c00cb1aca15c4dea4198c4e488a986fa6ad9636c
Component: engine
2014-01-29 10:38:10 -08:00
494e7dcbd4 exexdriver: Make Command.GetExitCode an internal call
This code only works for backends that directly spawn the child
via the Command. It will not work for the libvirt backend. So
we move this code into the individual backends that need it.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 9ad70528b723810d98e77368458408e85eebdfee
Component: engine
2014-01-28 19:20:35 +01:00
4729a480ab execdriver: Make GetPidsForContainer() a driver call
The current implementation is lxc specific.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 335bc39c9a5abfdbd07914ae1b8667a9d8590a6e
Component: engine
2014-01-28 16:21:49 +01:00
225e97e755 Merge pull request #3724 from creack/extract-lxc-phase-2
Refactor process to command
Upstream-commit: 0dd856ee7f636c82e9420ebbd9e2d0b3aeea5136
Component: engine
2014-01-23 15:28:45 -08:00
b038ed039d Compile driver interface changes
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: ba8ca598625215499713a9b65001164b672e69ab
Component: engine
2014-01-22 14:05:01 -08:00
62292fd956 Fix handling of shared roots
If rootIsShared() is detected we apply the shell stuff to early, before
the real command and arguments are added to the parameters. This
means they get passed on to unshare rather than docker-init, breaking
docker on e.g. fedora like:

goroutine 1 [running]:
runtime.panic(0x678340, 0x9b3fd7)
	/usr/lib64/golang/src/pkg/runtime/panic.c:266 +0xb6
github.com/dotcloud/docker/execdriver/lxc.func·001(0xc21000a1b0, 0xc21001eab0, 0x7fff24715faf)
	/home/alex/vcs/go/src/github.com/dotcloud/docker/execdriver/lxc/driver.go:41 +0x525
github.com/dotcloud/docker/sysinit.executeProgram(0xc21000a1b0, 0xc21000a1b0, 0xa)
	/home/alex/vcs/go/src/github.com/dotcloud/docker/sysinit/sysinit.go:34 +0xca
github.com/dotcloud/docker/sysinit.SysInit()
	/home/alex/vcs/go/src/github.com/dotcloud/docker/sysinit/sysinit.go:88 +0x791
main.main()
	/home/alex/vcs/go/src/github.com/dotcloud/docker/dockerinit/dockerinit.go:14 +0x1a

The fix is to construct the full params array before escaping it.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 08ab55419549374742bc879261f1d55b19af7265
Component: engine
2014-01-21 10:22:13 +01:00
5b95959a09 Rename Process to Command
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Upstream-commit: 12468f2bc8a72a6bedfd681084863ea95b48713b
Component: engine
2014-01-20 16:05:07 -08:00
5de2521000 Don't expose cgroups via the execdriver API.
Use Resources to represent container limits rather than a cgroup specific field.

Docker-DCO-1.1-Signed-off-by: Paul Nasrat <pnasrat@gmail.com> (github: pnasrat)
Upstream-commit: 71c1646ba33da9b2567ad7a2f4cda0433c9718dd
Component: engine
2014-01-20 17:06:24 -05:00
c8d1294225 Extract cgroups pkg.
Initial move before enhancing cgroups package.

Docker-DCO-1.1-Signed-off-by: Paul Nasrat <pnasrat@gmail.com> (github: pnasrat)
Upstream-commit: 2553029959929184696e25ebdba4631ba7aeb8a6
Component: engine
2014-01-20 14:15:44 -05:00
ce11258e8e Fix rebase for init error
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: d5112ffce60625e470515578ccd446a191dd9e88
Component: engine
2014-01-17 17:42:58 -08:00
96611d5300 Make sure drivers are registerd within sysinit
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 97c84507054a7379c8f8b461773b9c8d4972902b
Component: engine
2014-01-17 17:42:58 -08:00
3a041a0663 Change drvier name to append version
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: cdfebc2a20e76d4ea81eb154b748e0547a7e7ab5
Component: engine
2014-01-17 17:42:58 -08:00
8771a3eaee Move lxc template into lxc driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 70a5cb95b31c7596886b7f94d292444654b9af8d
Component: engine
2014-01-17 17:42:58 -08:00
d65bec8d4a Small fixes to type names
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: ca8dd73fbfa7aca0768278ff1ff9671f80c48138
Component: engine
2014-01-17 17:42:22 -08:00
ae872300fb Cleanup + add Info to driver in order to have specific IsRunning()
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)

Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: crosbymichael)
Upstream-commit: 889b4b10ae3ec1d6e7879c30860aafd7674cb576
Component: engine
2014-01-17 17:42:22 -08:00
ab79ba703f Move docker init into drivers functions
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)

Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: crosbymichael)
Upstream-commit: f7684ea7f61c0c69033c27605e9ad9a0a76e74cd
Component: engine
2014-01-17 17:42:22 -08:00
ecb354d61e Improve wait for lxc and driver interface
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 8c9f62d037a1bc82742ea316adaaf658af56b7c3
Component: engine
2014-01-17 17:42:22 -08:00
749c5a2471 Add json tags and comments to exedriver types
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: e765c67b477308643c8b1b4f84bee3572bf5ec98
Component: engine
2014-01-17 17:42:22 -08:00