Граф коммитов

68 Коммитов

Автор SHA1 Сообщение Дата
Alexander Larsson 6c266c4b42 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)
2014-03-13 20:01:29 +01:00
Alexander Larsson 636959e20a 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)
2014-03-13 20:01:29 +01:00
Guillaume J. Charmes fd0737df2c
Update parseLxcInfo to comply with new lxc1.0 format
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
2014-03-11 12:08:32 -07:00
Guillaume J. Charmes 721562f296
Remove goroutine leak upon error
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
2014-03-11 11:39:28 -07:00
unclejack 1695c77c43 Merge pull request #4509 from crosbymichael/kill-all
Remove the ghosts and kill everything
2014-03-07 01:35:38 +02:00
Michael Crosby 772ef99d28 Remove the ghosts and kill everything
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-03-06 15:30:26 -08:00
Michael Crosby 69e3d30bb6 Return correct process pid for lxc
Fixes #2875
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-03-05 18:02:19 -08:00
Victor Vieux f30f823bf5 fix docker info with lxc 1.0.0
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-02-28 00:32:58 +00:00
unclejack 22da8cdc7e Merge pull request #4282 from ibuildthecloud/jumbo-frames
Add MTU to lxc conf to make host and container MTU match
2014-02-26 20:11:38 +02:00
unclejack d8b60cb592 Merge pull request #4308 from vbatts/vbatts-seperate_driver_term
seperate out the terminal functions from lxc
2014-02-26 16:58:21 +02:00
Vincent Batts c35853191c correcting the package name for the terminal setup
Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
2014-02-25 10:07:06 -05:00
Michael Crosby 757c7581c8 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)
2014-02-24 13:42:13 -08:00
Vincent Batts de848a14ca 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)
2014-02-24 13:42:09 -05:00
Michael Crosby aac702727e Move current tty and pipe impl to lxc driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-02-21 13:27:34 -08:00
Michael Crosby 592c2f6f9a Move term creation into driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-02-21 12:42:37 -08:00
Michael Crosby 1e74287698 Change Console to Terminal
Move creation and attach to driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-02-21 12:32:14 -08:00
Darren Shepherd 0db53bd2ec 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)
2014-02-21 03:02:06 -07:00
Michael Crosby 9e3da87a3a Cleanup some statements from exec driver work
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-02-14 17:28:50 -08:00
Guillaume J. Charmes 408ea0771a
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)
2014-02-13 17:23:09 -08:00
Michael Crosby 3c215ba410 Merge pull request #4059 from alexlarsson/no-netadmin-caps
lxc: Drop NET_ADMIN capability in non-privileged containers
2014-02-11 14:20:34 -05:00
Alexander Larsson 02fddffd51 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)
2014-02-11 11:17:34 +01:00
Victor Vieux 2dcb48af0f Merge pull request #3524 from tianon/supplementary-groups
Add supplementary groups lookup in sysinit
2014-02-10 14:42:14 -08:00
Victor Vieux 036900a63a Merge pull request #3871 from jdef/patch-1
Update lxc_template.go
2014-02-10 14:38:39 -08:00
Guillaume J. Charmes 7c06d5e34e
Remove panic in lxc driver.
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-02-07 19:09:52 -08:00
James DeFelice 17c124baf6 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)
2014-02-03 16:14:15 -05:00
Tianon Gravi ee93f6185b 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)
2014-01-31 20:15:24 -07:00
Victor Vieux 523341d994 Merge pull request #3857 from creack/remove_darwin_files
Remove all darwin specific files and use more generic _unsupported with build tags.
2014-01-31 11:48:10 -08:00
Michael Crosby f267938fb8 Merge pull request #3844 from clkao/lxc-kill-deprecation
Use lxc-stop -k instead of lxc-kill
2014-01-31 10:57:40 -08:00
Tianon Gravi 065dd231dd 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)
2014-01-31 03:16:42 -07:00
Guillaume J. Charmes 45dd051e8e 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)
2014-01-30 23:10:56 +00:00
Victor Vieux 720f64af18 fix TestExitCode
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
2014-01-30 22:59:21 +00:00
Chia-liang Kao b111fc3646 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)
2014-01-31 03:22:22 +08:00
Michael Crosby c00cb1aca1 Merge pull request #3808 from alexlarsson/execdriver-get-pids-for-container
execdriver: Make GetPidsForContainer() a driver call
2014-01-29 10:38:10 -08:00
Alexander Larsson 9ad70528b7 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)
2014-01-28 19:20:35 +01:00
Alexander Larsson 335bc39c9a 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)
2014-01-28 16:21:49 +01:00
Victor Vieux 0dd856ee7f Merge pull request #3724 from creack/extract-lxc-phase-2
Refactor process to command
2014-01-23 15:28:45 -08:00
Michael Crosby ba8ca59862 Compile driver interface changes
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-01-22 14:05:01 -08:00
Alexander Larsson 08ab554195 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)
2014-01-21 10:22:13 +01:00
Guillaume J. Charmes 12468f2bc8
Rename Process to Command
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-01-20 16:05:07 -08:00
Paul Nasrat 71c1646ba3 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)
2014-01-20 17:06:24 -05:00
Paul Nasrat 2553029959 Extract cgroups pkg.
Initial move before enhancing cgroups package.

Docker-DCO-1.1-Signed-off-by: Paul Nasrat <pnasrat@gmail.com> (github: pnasrat)
2014-01-20 14:15:44 -05:00
Michael Crosby d5112ffce6 Fix rebase for init error
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-01-17 17:42:58 -08:00
Michael Crosby 97c8450705 Make sure drivers are registerd within sysinit
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-01-17 17:42:58 -08:00
Michael Crosby cdfebc2a20 Change drvier name to append version
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-01-17 17:42:58 -08:00
Michael Crosby 70a5cb95b3 Move lxc template into lxc driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-01-17 17:42:58 -08:00
Michael Crosby ca8dd73fbf Small fixes to type names
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-01-17 17:42:22 -08:00
Guillaume J. Charmes 889b4b10ae 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)
2014-01-17 17:42:22 -08:00
Guillaume J. Charmes f7684ea7f6 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)
2014-01-17 17:42:22 -08:00
Michael Crosby 8c9f62d037 Improve wait for lxc and driver interface
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-01-17 17:42:22 -08:00
Michael Crosby e765c67b47 Add json tags and comments to exedriver types
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-01-17 17:42:22 -08:00