Commit Graph

3120 Commits

Author SHA1 Message Date
44ded729ad folders->directories
Signed-off-by: hsinko <21551195@zju.edu.cn>
Upstream-commit: 772f5495b7bb03a8fb97f9ae5fb5fa97c98a87b3
Component: engine
2016-02-29 21:32:30 -08:00
7097a625ab Merge pull request #20710 from Microsoft/sjw/tp4retry_fix
Fixing retry hack for TP4 to return errors in all failure cases.
Upstream-commit: 6a960069596a5d43a50b7675454169aad06972ca
Component: engine
2016-02-29 19:08:24 -05:00
e32705bbc7 Merge pull request #20480 from wenchma/20431-filter_since_before
Enhancement of docker ps before and since filters
Upstream-commit: 9eb4575f8cdb8f9afb0d53d6fd4a34b077cc08da
Component: engine
2016-02-29 20:57:43 +01: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
6324c7793e Merge pull request #20605 from mountkin/optimize-json-log-writer
make the json log writer much faster
Upstream-commit: ba5a282a83a603c3bb61cd40642af54d2088f747
Component: engine
2016-02-29 10:47:46 -08:00
70ddfe143d Merge pull request #20749 from mountkin/validate-log-opts
validate log-opt when creating containers
Upstream-commit: 2391794d2695079f2dd19b10cd51aea6922b3ec9
Component: engine
2016-02-29 13:47:25 -05:00
66f153da0f Merge pull request #20774 from hqhq/hq_vender_engine_api
Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c
Upstream-commit: b211e57f23848bd1990db84d2ccce0ce529e735a
Component: engine
2016-02-29 18:48:55 +01:00
98394b0b6e Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: 53b0d62683ee798198c553353dc2106623a9259b
Component: engine
2016-02-29 19:28:37 +08:00
5f0c16d34d Merge pull request #20604 from coolljt0725/fix_reload
Fix configuration reloading
Upstream-commit: 20a038eca68e4188e1cd812293aea8cb220cf08f
Component: engine
2016-02-29 07:14:15 +01:00
c3440ba69f validate log-opt when creating containers
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: 7285c9a53a6a661e7ded4637d937f9d20dcf46c0
Component: engine
2016-02-28 01:51:46 +08:00
a63e28ad6f fix double-lock
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: e386dfc33fc1fd5ed06496bd19f01a37c3c46341
Component: engine
2016-02-27 09:49:21 -05:00
f76950a71a Revert "Add finer-grained locking for aufs"
This reverts commit f31014197cbe9438cc956ed12c47093a0324c82d.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: c2f7777603039b0e9b7e8fcdf517b1486dc14781
Component: engine
2016-02-27 08:01:19 -05: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
7c97092faa Merge pull request #20275 from cpuguy83/finer_graph_locks
Finer graph locks
Upstream-commit: 2f797bb1d9826f1aba242965b611b71b81fd152e
Component: engine
2016-02-26 13:33:34 -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
5bfa2d9a1f Merge pull request #20655 from hqhq/hq_fix_update_memoryswap
Fix problems when update swap memory
Upstream-commit: 6748cc10ac280950103d88a249f7d443715cf833
Component: engine
2016-02-25 22:28:53 -05:00
ac8b4b9a6a Add finer-grained locking for aufs
```
benchmark                       old ns/op       new ns/op     delta
BenchmarkConcurrentAccess-8     10269529748     26834747      -99.74%

benchmark                       old allocs     new allocs     delta
BenchmarkConcurrentAccess-8     309948         7232           -97.67%

benchmark                       old bytes     new bytes     delta
BenchmarkConcurrentAccess-8     23943576      1578441       -93.41%
```

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: f31014197cbe9438cc956ed12c47093a0324c82d
Component: engine
2016-02-25 18:06:41 -05:00
085a86e475 Fix some issues with concurrency in aufs.
Adds a benchmark to measure performance under concurrent actions.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 55c91f2ab9bcd48cfa248a4e842bb78257c14134
Component: engine
2016-02-25 14:32:13 -05:00
5f817c4ab4 Merge pull request #20685 from estesp/userns-dev-fuse-fix
Filter auto-created device list if user namespaces enabled
Upstream-commit: 13b6733ee82f1e3f8749dccf345a0874382b0d8e
Component: engine
2016-02-25 10:01:13 +01:00
a59cde77dc Enhancement of docker ps before and since filters
This enhancement is to fix the wrong list results on
`docker ps` before and since filters specifying the non-running container.

Fixes issue #20431

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
Upstream-commit: bc72883fe13b5cc39235b4996064bea7a5528ebf
Component: engine
2016-02-25 16:58:31 +08: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
4d716f809c Merge pull request #20647 from coolljt0725/fix_20638
Fix exec start api with detach and AttachStdin at same time. fixes #2…
Upstream-commit: cee4ff1c4ac0bb47ed847f3bb725fd6233613937
Component: engine
2016-02-24 20:17:15 -08:00
ba3d7fd0c4 Fix configuration reloading
There are five options 'debug' 'labels' 'cluster-store' 'cluster-store-opts'
and 'cluster-advertise' that can be reconfigured, configure any of these
options should not affect other options which may have configured in flags.
But this is not true, for example, I start a daemon with -D to enable the
debugging, and after a while, I want reconfigure the 'label', so I add a file
'/etc/docker/daemon.json' with content '"labels":["test"]' and send SIGHUP to daemon
to reconfigure the daemon, it work, but the debugging of the daemon is also diabled.
I don't think this is a expeted behaviour.
This patch also have some minor refactor of reconfiguration of cluster-advertiser.
Enable user to reconfigure cluster-advertiser without cluster-store in config file
since cluster-store could also be already set in flag, and we only want to reconfigure
the cluster-advertiser.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: b9366c9609166d41e987608041b5a2079726aa5f
Component: engine
2016-02-24 21:12:14 -05:00
d1a3bc5db1 Fix exec start api with detach and AttachStdin at same time. fixes #20638
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: fb0ac1afd97e6e3bf3c13dcda5821f36b56cc62b
Component: engine
2016-02-24 21:04:44 -05:00
ab6aa3583c Merge pull request #20641 from cpuguy83/revert_inotify_changes
Revert fsnotify changes
Upstream-commit: a7fefcf16cda4f91b9526b4db6d06ef12652f419
Component: engine
2016-02-24 10:10:03 -08:00
828abfa863 add file poller panic fix from 1.10.2
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: f9524a4d24d6135ae1777738390e1f6a590a7a1c
Component: engine
2016-02-24 10:17:29 -05:00
34876f5fef Merge pull request #20017 from calavera/expose_volumes_in_ps
Add mounts to docker ps.
Upstream-commit: 034a1a8dfd17d89123bf0405f898e880575ed775
Component: engine
2016-02-24 11:08:21 +01:00
1fba362e2f Restore container configs when update failed
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: fa3b1971578b3e270417df0215eeacaa03e881cf
Component: engine
2016-02-24 14:23:48 +08:00
da2ba30b2d Support update swap memory only
We should support update swap memory without memory.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: 8ae6f6ac28c1e9e28c1503b8118691580b66d885
Component: engine
2016-02-24 13:36:47 +08:00
0a8b8e629c Revert "use pubsub instead of filenotify to follow json logs"
This reverts commit b1594c59f5e0d1ac898eacde8d91b1ba33c2b626.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 91fdfdd53722179b21b80b9dfbe8bc2e09d0a7b1
Component: engine
2016-02-23 21:43:52 -05:00
edf220176a Add mounts to docker ps.
- Allow to filter containers by volume with `--filter volume=name` and `filter volume=/dest`.
- Show their names in the list with the custom format `{{ .Mounts }}`.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: bd4fb00fb6241d35537b460a2d9f48256111ae7a
Component: engine
2016-02-23 12:10:24 -05:00
1805b24705 make the json log writer much faster
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: d7af03111495cadd71abd3a8b5805066ea688e9b
Component: engine
2016-02-23 19:28:06 +08:00
f62b97e499 Fix some typos in comments and strings
Most of them were found and fixed by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Upstream-commit: 2eee613326fb59fd168849618d14a9054a40f9f5
Component: engine
2016-02-22 20:27:15 +01: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
7b8239e00e Merge pull request #20471 from calavera/userland_proxy_config_fix
Avoid setting default truthy values from flags that are not set.
Upstream-commit: 6668326aa8cbb8af32bb49b4a843be2cae762cb3
Component: engine
2016-02-19 21:00:37 -05:00
2d2a092a9b Merge pull request #20446 from estesp/fix-userns-cp
Fix copy chown settings to not default to real root
Upstream-commit: 3d65e7126c60ef23a7f0e255cd2e4b5938859413
Component: engine
2016-02-19 19:45:44 -05:00
2625f17a24 Avoid setting default truthy values from flags that are not set.
When the value for a configuration option in the file is `false`,
and the default value for a flag is `true`, we should not
take the value from the later as final value for the option,
because the user explicitly set `false`.

This change overrides the default value in the flagSet with
the value in the configuration file so we get the correct
result when we merge the two configurations together.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 31cb96dcfaaebe3f807e7c7bf82a48b5995c743b
Component: engine
2016-02-19 18:39:10 -05: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
d9c028ed66 Merge pull request #20419 from aboch/cr
Allow passing global datastore to libnetwork and v0.7.0-dev1 vendoring
Upstream-commit: 117a982d2e805d3279ff75fcec071635e5191ef6
Component: engine
2016-02-18 17:39:46 -08:00
b3b5161196 Fix copy chown settings to not default to real root
This corrects `docker cp` behavior when user namespaces are enabled.
Instead of chown'ing copied-in files to real root (0,0), the code
queries for the remapped root uid & gid and sets the chown option
properly.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
Upstream-commit: 40be5dba473aa57a388fe26bb79ac38a66653f31
Component: engine
2016-02-18 14:44:13 -08:00
fa1db664e1 Invoke ReloadConfiguration on network controller
- It reverts fa163f5619bb01cabca1c21 plus a small change
  in order to allow passing the global scope datastore
  to libnetwork after damon boot.

Signed-off-by: Alessandro Boch <aboch@docker.com>
Upstream-commit: ed364b69df0432d0143e7661c4c0695377ceef7b
Component: engine
2016-02-18 12:14:14 -08:00
7d665cca4e Merge pull request #17513 from aidanhs/aphs-expose-ipv6-default-bridge
Expose bridge IPv6 setting to `docker network inspect`
Upstream-commit: 2e6c841b826cc73332c44d5a04a5996fc65af724
Component: engine
2016-02-18 10:35:04 -08:00
684142a88d Merge pull request #20333 from rhatdan/mqueue
/dev/mqueue should never be mounted readonly
Upstream-commit: be5939f40778d8056edff621153391e322f149d5
Component: engine
2016-02-18 11:02:17 -05:00
0376c9075e Merge pull request #20407 from tiborvass/backmerge-1.10.1
Backmerge 1.10.1 fixes to master
Upstream-commit: b26c21f7040c89b055d4fe135e45b3ab0b881ddb
Component: engine
2016-02-17 13:45:43 -08:00
ea1de57ceb Don’t stop daemon on migration hard failure
Also changes missing storage layer for container
RWLayer to a soft failure.

Fixes #20147

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 2798d7a6a681aee8995e87c9b68128e54876d2b5)
Upstream-commit: 55080fc03bed4dba85d5c5760363b92851ff728f
Component: engine
2016-02-17 14:26:30 -05:00
83d138a180 Merge pull request #20366 from LK4D4/socks_proxy
Add support for forwarding Docker client through SOCKS proxy
Upstream-commit: 5c78515430860ad822e016cc5cd5d5ff3dd6a21c
Component: engine
2016-02-16 22:29:49 -08:00
5aea778205 Merge pull request #19689 from cednation/etwlogs
Windows: Add ETW logging driver plug-in
Upstream-commit: c795d0bab9057fbf16ca70349bcc37e244be33b9
Component: engine
2016-02-16 15:01:17 -08:00