Commit graph

96 commits

Author SHA1 Message Date
Qiang Huang
8799c4fc0f Implemet docker update command
It's used for updating properties of one or more containers, we only
support resource configs for now. It can be extended in the future.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-12-28 19:19:26 +08:00
Mrunal Patel
e8f7d5885d Update runc/libcontainer to v0.0.6
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2015-12-11 15:24:32 -05:00
Dan Walsh
b3e527dfd2 This patch adds --tmpfs as a option for mounting tmpfs on directories
It will Tar up contents of child directory onto tmpfs if mounted over

This patch will use the new PreMount and PostMount hooks to "tar"
up the contents of the base image on top of tmpfs mount points.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2015-12-02 10:06:59 -05:00
Antonio Murdaca
1b726b29b2 daemon: remove sysInitPath, lxc leftover
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2015-11-30 10:04:13 +01:00
Alexander Morozov
419fd7449f Use fs cgroups by default
Our implementation of systemd cgroups is mixture of systemd api and
plain filesystem api. It's hard to keep it up to date with systemd and
it already contains some nasty bugs with new versions. Ideally it should
be replaced with some daemon flag which will allow to set parent systemd
slice.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-11-18 16:16:13 -08:00
Dan Walsh
0c518b6ab2 Docker is calling cont.Destroy twice on success
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2015-10-19 14:53:55 -04:00
Antonio Murdaca
cfcddefacd daemon: execdriver: lxc: fix cgroup paths
When running LXC dind (outer docker is started with native driver)
cgroup paths point to `/docker/CID` inside `/proc/self/mountinfo` but
these paths aren't mounted (root is wrong). This fix just discard the
cgroup dir from mountinfo and set it to root `/`.
This patch fixes/skip OOM LXC tests that were failing.
Fix #16520

Signed-off-by: Antonio Murdaca <runcom@linux.com>
Signed-off-by: Antonio Murdaca <amurdaca@redhat.com>
2015-10-13 14:46:59 -07:00
Phil Estes
442b45628e Add user namespace (mapping) support to the Docker engine
Adds support for the daemon to handle user namespace maps as a
per-daemon setting.

Support for handling uid/gid mapping is added to the builder,
archive/unarchive packages and functions, all graphdrivers (except
Windows), and the test suite is updated to handle user namespace daemon
rootgraph changes.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2015-10-09 17:47:37 -04:00
Tibor Vass
b08f071e18 Revert "Merge pull request #16228 from duglin/ContextualizeEvents"
Although having a request ID available throughout the codebase is very
valuable, the impact of requiring a Context as an argument to every
function in the codepath of an API request, is too significant and was
not properly understood at the time of the review.

Furthermore, mixing API-layer code with non-API-layer code makes the
latter usable only by API-layer code (one that has a notion of Context).

This reverts commit de41640435, reversing
changes made to 7daeecd42d.

Signed-off-by: Tibor Vass <tibor@docker.com>

Conflicts:
	api/server/container.go
	builder/internals.go
	daemon/container_unix.go
	daemon/create.go
2015-09-29 14:26:51 -04:00
Doug Davis
26b1064967 Add context.RequestID to event stream
This PR adds a "request ID" to each event generated, the 'docker events'
stream now looks like this:

```
2015-09-10T15:02:50.000000000-07:00 [reqid: c01e3534ddca] de7c5d4ca927253cf4e978ee9c4545161e406e9b5a14617efb52c658b249174a: (from ubuntu) create
```
Note the `[reqID: c01e3534ddca]` part, that's new.

Each HTTP request will generate its own unique ID. So, if you do a
`docker build` you'll see a series of events all with the same reqID.
This allow for log processing tools to determine which events are all related
to the same http request.

I didn't propigate the context to all possible funcs in the daemon,
I decided to just do the ones that needed it in order to get the reqID
into the events. I'd like to have people review this direction first, and
if we're ok with it then I'll make sure we're consistent about when
we pass around the context - IOW, make sure that all funcs at the same level
have a context passed in even if they don't call the log funcs - this will
ensure we're consistent w/o passing it around for all calls unnecessarily.

ping @icecrime @calavera @crosbymichael

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-09-24 11:56:37 -07:00
Hu Keping
f05bacbe50 Events for OOM needs to be shift to an earlier time
It's worth to warn user as soon as possilbe when OOM happend.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-09-21 10:18:08 +08:00
Madhu Venugopal
e148e763b8 Update native execdriver to exploit libcontainer hooks
Using @mavenugo's patch for enabling the libcontainer pre-start hook to
be used for network namespace initialization (correcting the conflict
with user namespaces); updated the boolean check to the more generic
SupportsHooks() name, and fixed the hook state function signature.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2015-09-16 12:51:14 -04:00
Hu Keping
40d3ce1063 Minor typo
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-09-10 14:13:15 +08:00
Jessica Frazelle
e542238f2a remove docker-unconfined profile we were not using it and it breaks apparmor on wheezy
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2015-08-06 16:51:01 -07:00
Qiang Huang
e34f562a77 Add back golint for daemon/execdriver/native
It's broken by #15099 Fix it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-07-30 08:58:54 +08:00
Jessie Frazelle
d7661cb48b Merge pull request #15099 from ewindisch/apparmor-restore-en
Restore AppArmor generation + fixes
2015-07-29 09:36:59 -07:00
Eric Windisch
3edc88f76d Restore AppArmor profile generation
Will attempt to load profiles automatically. If loading fails
but the profiles are already loaded, execution will continue.

A hard failure will only occur if Docker cannot load
the profiles *and* they have not already been loaded via
some other means.

Also introduces documentation for AppArmor.

Signed-off-by: Eric Windisch <eric@windisch.us>
2015-07-28 17:45:51 -04:00
Qiang Huang
3d17c3bb66 Fix golint warnings for daemon/execdriver/*
Addresses: #14756

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-07-28 08:43:22 +08:00
Qiang Huang
af3059855c Remove unused parameter in NewTtyConsole
It's introduced in
68ba5f0b69 (Execdriver implementation on new libcontainer API)

But I don't see reson why we need it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-07-22 10:32:31 +08:00
Alexander Morozov
6ae377ffa0 Remove unused TtyTerminal interface
It was used only by integration tests, which now gone.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-21 09:56:28 -07:00
Eric Windisch
80d99236c1 Move AppArmor policy to contrib & deb packaging
The automatic installation of AppArmor policies prevents the
management of custom, site-specific apparmor policies for the
default container profile. Furthermore, this change will allow
a future policy for the engine itself to be written without demanding
the engine be able to arbitrarily create and manage AppArmor policies.

- Add deb package suggests for apparmor.
- Ubuntu postinst use aa-status & fix policy path
- Add the policies to the debian packages.
- Add apparmor tests for writing proc files
Additional restrictions against modifying files in proc
are enforced by AppArmor. Ensure that AppArmor is preventing
access to these files, not simply Docker's configuration of proc.
- Remove /proc/k?mem from AA policy
The path to mem and kmem are in /dev, not /proc
and cannot be restricted successfully through AppArmor.
The device cgroup will need to be sufficient here.
- Load contrib/apparmor during integration tests
Note that this is somewhat dirty because we
cannot restore the host to its original configuration.
However, it should be noted that prior to this patch
series, the Docker daemon itself was loading apparmor
policy from within the tests, so this is no dirtier or
uglier than the status-quo.

Signed-off-by: Eric Windisch <eric@windisch.us>
2015-07-21 11:05:53 -04:00
Alexander Morozov
c86189d554 Update libcontainer
Replaced github.com/docker/libcontainer with
github.com/opencontainers/runc/libcontaier.
Also I moved AppArmor profile generation to docker.

Main idea of this update is to fix mounting cgroups inside containers.
After updating docker on CI we can even remove dind.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-16 16:02:26 -07:00
unclejack
c1477db04f daemon: lower allocations
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2015-06-30 01:45:31 +03:00
Alexander Morozov
f1b59d64d2 Remove useless debug message
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-06-01 11:15:15 -07:00
Antonio Murdaca
9e425d56d0 Add lock before accessing native driver active containers
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-26 13:55:02 +02:00
Antonio Murdaca
77280a87b7 Fix race in stats cli and native driver
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-26 13:55:02 +02:00
Alexander Morozov
ca7219f5da Fix race between execdriver.Kill and execdriver.Run
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-05-11 13:23:50 -07:00
John Howard
390f3c99d3 Fix os.MkdirAll in native driver
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-05-07 12:09:30 -07:00
Jessica Frazelle
2afcd10202 option to configure cgroups
Signed-off-by: Jessica Frazelle <jess@docker.com>
2015-04-27 17:50:39 -07:00
Daniel, Dao Quang Minh
ade8146aa8 reuse same code for setting pipes in run/exec
This also moves `exec -i` test to _unix_test.go because it seems to need a
pty to reliably reproduce the behavior.

Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
2015-04-23 21:54:21 +00:00
Ma Shimiao
e607bb49c4 clenaup: delete unused function getEnv
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-20 16:32:42 +08:00
Michael Crosby
a5f7c4aa31 Ensure state is destroyed on daemont restart
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-04-15 17:44:03 -07:00
Alexander Morozov
ac8bd12b39 Get process list after PID 1 dead
Fix #11087

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-04-10 16:23:57 -07:00
Mrunal Patel
195bebd3a7 Removes unused function.
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2015-04-07 18:15:28 -04:00
guoxiuyan
ffcc4a1e52 Fix a minor typo
Signed-off-by: Guo Xiuyan <guoxiuyan@huawei.com>
2015-04-04 15:36:35 +08:00
Michael Crosby
7061a993c5 Return closed channel if oom notification fails
When working with Go channels you must not set it to nil or else the
channel will block forever.  It will not panic reading from a nil chan
but it blocks.  The correct way to do this is to create the channel then
close it as the correct results to the caller will be returned.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-04-01 15:30:48 -07:00
Alexander Morozov
f468bbb7e8 Do not mask *exec.ExitError
Fix #11764

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-30 15:31:49 -07:00
Alexander Morozov
5a1e5cf8c9 Get child processes before main process die
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-30 13:28:34 -07:00
Alexander Morozov
489ab77f4a Use proper wait function for --pid=host
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-30 13:27:38 -07:00
Antonio Murdaca
6f4d847046 Replace aliased imports of logrus, fixes #11762
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-26 23:22:04 +01:00
Alexander Morozov
1e788ec985 Use /var/run/docker as root for execdriver
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-24 10:47:30 -07:00
Michael Crosby
2b12b099b8 Mount libcontainer state dir in tmpfs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-03-19 14:27:17 -07:00
Michael Crosby
06c939e527 Ensure the container state is removed on daemon boot
This ensures that the libcontainer state is fully removed for a
container after it is terminated.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-03-19 14:21:19 -07:00
Michael Crosby
a2fcae41ef Merge pull request #11343 from hqhq/hq_fix_panic_error
fix panic error when docker stats a stopped container
2015-03-16 15:16:03 -07:00
Qiang Huang
8dc5791f73 fix panic error when docker stats a stopped container
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-16 19:55:34 +08:00
Qiang Huang
bffe04b582 fix warning messages
Use log.Warnf instead of log.Infof, and remove redundant `WARNING` prefix.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-11 08:47:45 +08:00
Alexander Morozov
68ba5f0b69 Execdriver implementation on new libcontainer API
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-06 14:46:58 -08:00
Abin Shahab
1a26ed09ee Implements stats for lxc driver
Implements stats and fixes stats test.

Signed-off-by: Abin Shahab <ashahab@altiscale.com> (github: ashahab-altiscale)
2015-02-23 10:16:52 +00:00
Alexander Morozov
e995670935 Fix possible panic on killing container
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-02-18 11:27:38 -08:00
Michael Crosby
2d4fc1de05 Refactor usage calc for CPU and system usage
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-01-20 20:21:46 -08:00