Commit Graph

517 Commits

Author SHA1 Message Date
8366a6bcc0 remove dead code
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: 8dd88afb5b5f8ce353c00bfc71edf8238f3a0452
Component: engine
2016-03-16 19:15:14 -07:00
3dbccba8c4 Merge pull request #20478 from msabansal/HNSIntegration
Windows libnetwork integration
Upstream-commit: 2b8e7ad4609e668d2187e81055e1e76ed0c11552
Component: engine
2016-03-10 13:33:04 -08:00
75088991dc Merge pull request #21018 from hqhq/hq_fix_race_exec_tty
Fix race condition when exec with tty
Upstream-commit: 790d8f8520d23d16cc0a141e6fd56246a45b327a
Component: engine
2016-03-10 08:27:54 -08:00
23f9a9fa41 Windows libnetwork integration
Signed-off-by: msabansal <sabansal@microsoft.com>
Upstream-commit: e8026d8a98ef30ff0ada303404e02567caebb1b0
Component: engine
2016-03-09 20:33:21 -08:00
356157b64b Merge pull request #18697 from jfrazelle/pids-cgroup
Add PIDs cgroup support to Docker
Upstream-commit: dd32445ecc6b706e8681dcc9d80c42c9b6cbf6cd
Component: engine
2016-03-08 14:03:36 -08:00
3d1795a330 Merge pull request #20727 from mrunalp/no_new_priv
Add support for NoNewPrivileges in docker
Upstream-commit: dc702b6c6bda5cd2d530e86804627c1a5a155e3c
Component: engine
2016-03-08 14:26:15 -05:00
de84e87a00 pids limit support
update bash commpletion for pids limit

update check config for kernel

add docs for pids limit

add pids stats

add stats to docker client

Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: 69cf03700fed7bf5eb7fe00c9214737e21478e49
Component: engine
2016-03-08 07:55:01 -08:00
9a568f22f0 Fix race condition when exec with tty
I can reproduce this easily on one of my servers,
`docker exec -ti my_cont ls` will not print anything,
without `-t` it acts normally.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: a444b5f60c75bdac82c9a7126738c210e2ccf941
Component: engine
2016-03-08 10:53:34 +08:00
3e9b68d581 Add support for NoNewPrivileges in docker
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

Add tests for no-new-privileges

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

Update documentation for no-new-privileges

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Upstream-commit: 74bb1ce9e9dbfa9dd866e84f891e865fca906d9a
Component: engine
2016-03-07 09:47:02 -08:00
6c9a39a756 Merge pull request #20934 from icecrime/20543_debugging
Fix race condition on daemon shutdown (#20543)
Upstream-commit: 2af84d8875045f853210dcdab2548daaad70856f
Component: engine
2016-03-04 11:08:50 -08:00
c66cb2a6ce Fix race in container creation
Only register a container once it's successfully started. This avoids a
race condition where the daemon is killed while in the process of
calling `libcontainer.Container.Start`, and ends up killing -1.

There is a time window where the container `initProcess` is not set, and
its PID unknown. This commit fixes the race Engine side.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: ad2fa3945997905760a4c7ef0444580ffb4b939a
Component: engine
2016-03-03 20:25:03 -08:00
209e95dee8 Write Windows layer diffs to tar in standard format
Previously, Windows layer diffs were written using a Windows-internal
format based on the BackupRead/BackupWrite Win32 APIs. This caused
problems with tar-split and tarsum and led to performance problems
in implementing methods such as DiffPath. It also was just an
unnecessary differentiation point between Windows and Linux.

With this change, Windows layer diffs look much more like their
Linux counterparts. They use AUFS-style whiteout files for files
that have been removed, and they encode all metadata directly in
the tar file.

This change only affects Windows post-TP4, since changes to the Windows
container storage APIs were necessary to make this possible.

Signed-off-by: John Starks <jostarks@microsoft.com>
Upstream-commit: 5649030e25bd87b4b0bbd200515b8c7317ae8ce1
Component: engine
2016-03-02 16:13:40 -08:00
cf6760a787 Remove some unused structs and fields
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 0a352e1a906fbf7592aa95d6327776236d13392a
Component: engine
2016-03-01 09:59:29 -08:00
210548216a Fixing retry hack for TP4 to return errors in all failure cases.
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Upstream-commit: 0b82202fbbbeaad5d7ba404fb586cb4b3f37980e
Component: engine
2016-02-29 10:53:01 -08:00
8135f8d68c Merge pull request #20699 from calavera/remove_static_error_declarations
Remove static errors from errors package.
Upstream-commit: df2b74188ec51422e84ec1dbdc58abf08c215019
Component: engine
2016-02-26 16:30:12 -08:00
e0b6d7e1f3 Merge pull request #20729 from estesp/pipework
Add synchronization and closure to IO pipes in userns path
Upstream-commit: 51302c29edf256276ba4ba9a20076866db522f66
Component: engine
2016-02-26 13:33:02 -08:00
b2ac99b3fa Remove static errors from errors package.
Moving all strings to the errors package wasn't a good idea after all.

Our custom implementation of Go errors predates everything that's nice
and good about working with errors in Go. Take as an example what we
have to do to get an error message:

```go
func GetErrorMessage(err error) string {
	switch err.(type) {
	case errcode.Error:
		e, _ := err.(errcode.Error)
		return e.Message

	case errcode.ErrorCode:
		ec, _ := err.(errcode.ErrorCode)
		return ec.Message()

	default:
		return err.Error()
	}
}
```

This goes against every good practice for Go development. The language already provides a simple, intuitive and standard way to get error messages, that is calling the `Error()` method from an error. Reinventing the error interface is a mistake.

Our custom implementation also makes very hard to reason about errors, another nice thing about Go. I found several (>10) error declarations that we don't use anywhere. This is a clear sign about how little we know about the errors we return. I also found several error usages where the number of arguments was different than the parameters declared in the error, another clear example of how difficult is to reason about errors.

Moreover, our custom implementation didn't really make easier for people to return custom HTTP status code depending on the errors. Again, it's hard to reason about when to set custom codes and how. Take an example what we have to do to extract the message and status code from an error before returning a response from the API:

```go
	switch err.(type) {
	case errcode.ErrorCode:
		daError, _ := err.(errcode.ErrorCode)
		statusCode = daError.Descriptor().HTTPStatusCode
		errMsg = daError.Message()

	case errcode.Error:
		// For reference, if you're looking for a particular error
		// then you can do something like :
		//   import ( derr "github.com/docker/docker/errors" )
		//   if daError.ErrorCode() == derr.ErrorCodeNoSuchContainer { ... }

		daError, _ := err.(errcode.Error)
		statusCode = daError.ErrorCode().Descriptor().HTTPStatusCode
		errMsg = daError.Message

	default:
		// This part of will be removed once we've
		// converted everything over to use the errcode package

		// FIXME: this is brittle and should not be necessary.
		// If we need to differentiate between different possible error types,
		// we should create appropriate error types with clearly defined meaning
		errStr := strings.ToLower(err.Error())
		for keyword, status := range map[string]int{
			"not found":             http.StatusNotFound,
			"no such":               http.StatusNotFound,
			"bad parameter":         http.StatusBadRequest,
			"conflict":              http.StatusConflict,
			"impossible":            http.StatusNotAcceptable,
			"wrong login/password":  http.StatusUnauthorized,
			"hasn't been activated": http.StatusForbidden,
		} {
			if strings.Contains(errStr, keyword) {
				statusCode = status
				break
			}
		}
	}
```

You can notice two things in that code:

1. We have to explain how errors work, because our implementation goes against how easy to use Go errors are.
2. At no moment we arrived to remove that `switch` statement that was the original reason to use our custom implementation.

This change removes all our status errors from the errors package and puts them back in their specific contexts.
IT puts the messages back with their contexts. That way, we know right away when errors used and how to generate their messages.
It uses custom interfaces to reason about errors. Errors that need to response with a custom status code MUST implementent this simple interface:

```go
type errorWithStatus interface {
	HTTPErrorStatusCode() int
}
```

This interface is very straightforward to implement. It also preserves Go errors real behavior, getting the message is as simple as using the `Error()` method.

I included helper functions to generate errors that use custom status code in `errors/errors.go`.

By doing this, we remove the hard dependency we have eeverywhere to our custom errors package. Yes, you can use it as a helper to generate error, but it's still very easy to generate errors without it.

Please, read this fantastic blog post about errors in Go: http://dave.cheney.net/2014/12/24/inspecting-errors

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: a793564b2591035aec5412fbcbcccf220c773a4c
Component: engine
2016-02-26 15:49:09 -05:00
5e9f05d546 Add synchronization and closure to IO pipes in userns path
The execdriver pipes setup uses OS pipes with fds so that they can be
chown'ed to the remapped root user for proper access. Recent flakiness
in certain short-lived tests (usually via the "exec" path) reveals that
the copy routines are not completing before exit/tear-down.

This fix adds synchronization and proper closure such that these
routines exit successfully.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
Upstream-commit: 995386735c2fe47ebb144f95adbc8eb1341ac48b
Component: engine
2016-02-26 13:47:34 -05:00
03ce1316a5 Merge pull request #20428 from jfrazelle/generate-conversion
generate seccomp profile convert type
Upstream-commit: c47674efda39226e7323e5668ee279927997fb4f
Component: engine
2016-02-26 10:28:23 -05:00
3a1a7f86d5 Filter auto-created device list if user namespaces enabled
Because devices will be bind-mounted instead of using `mknod`, we need
to make sure the source exists and filter the list by only those whose
source is a valid path/current device entry.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
Upstream-commit: 9a554e8c37d522ed791b3bb55f9ba9f21e2ac76a
Component: engine
2016-02-25 00:11:36 -05:00
f153cf13ed Update RestartPolicy of container
Add `--restart` flag for `update` command, so we can change restart
policy for a container no matter it's running or stopped.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: ff3ea4c90f2ede5cccc6b49c4d2aad7201c91a4c
Component: engine
2016-02-20 17:06:32 +08:00
bea41e64ba generate seccomp profile convert type
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: ad600239bca1ac89d9684a98d6f7f260959e81d2
Component: engine
2016-02-19 13:32:54 -08:00
dad375d1d2 /dev/mqueue should never be mounted readonly
If user specifies --read-only flag it should not effect /dev/mqueue.
This is causing SELinux issues in docker-1.10.  --read-only blows up
on SELinux enabled machines.  Mounting /dev/mqueue read/only would also
blow up any tool that was going to use /dev/mqueue.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Upstream-commit: adb2e3fedc76fbaecce0d75a29aa0d419be5c4c2
Component: engine
2016-02-15 14:56:07 -05:00
697a990701 fix common misspell
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 99a396902f0ea9d81ef87a683489b2435408f415
Component: engine
2016-02-11 15:49:36 -08:00
e9caeb643b Merge pull request #20210 from Microsoft/jjh/hcswin32-v2
Windows: Revendor HCS to use revised error scheme
Upstream-commit: dfebb6074f62891368cb3c668380c186f3bebb33
Component: engine
2016-02-10 17:20:14 -08:00
0fe9b6b4f3 Windows: Use new error code mechanism from HCS
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 54263a93933a4a53f44ddea58ac16b2526e136e3
Component: engine
2016-02-10 14:48:24 -08:00
f35a03ff6d Windows: Fix 'isolation'
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: d4b0732499feac87cf7c433b9490a4e21e94fb45
Component: engine
2016-02-10 13:19:19 -08:00
c8a52b977d Windows CI: Another reliability fix
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 7853193edbd55ea5596c4df54895132ee88dc8fe
Component: engine
2016-02-10 11:07:29 -08:00
1a4e7d1b20 Make mqueue container specific
mqueue can not be mounted on the host os and then shared into the container.
There is only one mqueue per mount namespace, so current code ends up leaking
the /dev/mqueue from the host into ALL containers.  Since SELinux changes the
label of the mqueue, only the last container is able to use the mqueue, all
other containers will get a permission denied.  If you don't have SELinux protections
sharing of the /dev/mqueue allows one container to interact in potentially hostile
ways with other containers.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Upstream-commit: ba38d58659cc155aebf89a2ea4cfc3cd7ba04a64
Component: engine
2016-02-05 16:50:35 +01:00
f7ee374e15 Remove case sensitive duplicate dir in vendor
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: b9a395c85de3f4ea10810c8df789fc67e5b4b604
Component: engine
2016-02-03 13:06:32 -08:00
9dd09cab07 Windows CI: One more reliability hack
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 14c53160d7477813839f6996cf340004ebe335c5
Component: engine
2016-02-02 13:15:35 -08:00
681c5de598 Windows CI: Re-do TP4 CI reliability hack
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 6f0831930fbccfbb2b7552b64a4b54698b4b861c
Component: engine
2016-02-02 09:36:18 -08:00
eb79a73a95 Merge pull request #19889 from Microsoft/jjh/reliabilitytake2
Windows CI: TP4 reliability hack
Upstream-commit: a39ad952ec1efc3b7536d3d8a93e96a22cd1818b
Component: engine
2016-02-01 22:30:51 -05:00
e2603dbc62 Windows CI: TP4 reliability hack
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 2ebcb48cf1b4f883260b62f687e2c54926749b68
Component: engine
2016-02-01 18:02:57 -08:00
dce9d7fda4 remove the unused Info interface in daemon/execdriver/driver.go and related code
Signed-off-by: Fangyuan Gao <21551127@zju.edu.cn>
Upstream-commit: 5d07d83ee0802391ff2ed5e10838376a9b817bba
Component: engine
2016-02-02 09:04:52 +08:00
025414686c Fix typos in create.go
There were a few spelling issues that I noticed when reading about shared mounts.

Signed-off-by: jgeiger <joey.geiger@irco.com>
Upstream-commit: 318b4f0b5f0639149f5e88aba805cdd454d4d9ee
Component: engine
2016-01-28 14:08:11 -07:00
25f186f583 Merge pull request #19688 from crosbymichael/tmpfs-tar
Remove tar copy-up for tmpfs mounts
Upstream-commit: 3a70ab3a2c78ab40a5fdfe55be5745753eb41139
Component: engine
2016-01-26 17:03:07 -08:00
0bed041a45 Move tar copy-up for tmpfs mounts
We cannot rely on the tar command for this type of operation because tar
versions, flags, and functionality can very from distro to distro.
Since this is in the container execution path it is not safe to have
this as a dependency from dockers POV where the user cannot change the
fact that docker is adding these pre and post mount commands.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: ae8ec4860e68e945cf6b2c157fa4e243c35c54a5
Component: engine
2016-01-26 14:00:39 -08:00
4edafc3bc1 *: purge dockerinit from source code
dockerinit has been around for a very long time. It was originally used
as a way for us to do configuration for LXC containers once the
container had started. LXC is no longer supported, and /.dockerinit has
been dead code for quite a while. This removes all code and references
in code to dockerinit.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
Upstream-commit: 4357ed4a7363a1032edf93cf03232953c805184f
Component: engine
2016-01-26 23:47:02 +11:00
7187db20a2 move default seccomp profile into package
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: bed0bb7d017bb4a8400ac2c031dc74cd74240bfb
Component: engine
2016-01-21 16:55:29 -08:00
190d8fab36 move default apparmor policy into package
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: 35e50119fc2a2a6d9bcdc95c000df8b66d6cb9d3
Component: engine
2016-01-21 16:55:27 -08:00
7141a04b13 Merge pull request #19263 from jfrazelle/update-aa-parser
refactor aaparser pkg, add unit tests
Upstream-commit: 3233f4560912fee87857f653a8bb32050dc04927
Component: engine
2016-01-21 19:40:53 -05:00
6541731269 add send, recv, and x32 so we can install i386 pkgs on amd64
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: 308eff99e8468be4e92951de0ac69b27042a833b
Component: engine
2016-01-18 19:24:01 -08:00
a0c04482f7 refactor aaparser pkg, add unit tests
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: 446f498ebac56d4ed396b6c20252d152926dc30e
Component: engine
2016-01-13 08:43:12 -08:00
fb652937c3 read seccomp profile locally then pass to daemon
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: 062d0b3921316bc348c7930ce6599e1f8f297090
Component: engine
2016-01-12 13:12:29 -08:00
622bd04e41 Merge pull request #19217 from justincormack/arm_syscalls
Add arm specific syscalls to default seccomp profile
Upstream-commit: a96a0b37818e26bea173aa718df92f50b21093c3
Component: engine
2016-01-11 15:26:09 -08:00
8e7c65a2dd Merge pull request #19069 from jfrazelle/apparmor-regex-proc
fix proc regex
Upstream-commit: 9c9a1d1b4bc2122548a38b233a2f26ab5304de4c
Component: engine
2016-01-11 13:50:25 -08:00
ddd50b3705 Merge pull request #18512 from euank/18510-fixOomKilled
Set OOMKilled state on any OOM event
Upstream-commit: 967acd56c175b7c0f3ad4236c664730338a94bb8
Component: engine
2016-01-11 00:09:26 +01:00
1567cd421d Add arm specific syscalls to default seccomp profile
Signed-off-by: Justin Cormack <justin.cormack@unikernel.com>
Upstream-commit: 37d35f3c280dc27a00f2baa16431d807b24f8b92
Component: engine
2016-01-10 19:55:24 +00:00
fd32c5b230 Add i386 specific modify_ldt syscall to default seccomp filter
This syscall is used by Go on i386 binaries, although not by libc.

Signed-off-by: Justin Cormack <justin.cormack@unikernel.com>
Upstream-commit: 13a9d4e8993997b2bf9be7e96a8d7978a73d0b9b
Component: engine
2016-01-10 12:00:11 +00:00