Commit Graph

1706 Commits

Author SHA1 Message Date
afc4d63ffe Merge pull request #20565 from kencochrane/remove_email_on_login
Remove email address field from login
Upstream-commit: 2453262e7ba131fede74dbf31df41da9d2f36c34
Component: engine
2016-03-01 08:02:16 -08:00
2919d69a0c Remove email address field from login
This removes the email prompt when you use docker login, and also removes the ability to register via the docker cli. Docker login, will strictly be used for logging into a registry server.

Signed-off-by: Ken Cochrane <kencochrane@gmail.com>
Upstream-commit: aee260d4eb3aa0fc86ee5038010b7bbc24512ae5
Component: engine
2016-02-29 17:53:27 -08:00
5692b958f8 Merge pull request #20792 from cpuguy83/more_stats_client_cleanup
Fixes issue with stats on start event
Upstream-commit: 187a2fb40390f52a45e5b77c2ccc2d4609e354a9
Component: engine
2016-02-29 17:33:37 -08:00
aa8f3c4116 Fixes issue with stats on start event
In situations where a client is called like `docker stats` with no
arguments or flags, if a container which was already created but not
started yet is then subsequently started it will not be added to the
stats list as expected.

Also splits some of the stats helpers to a separate file from the stats
CLI which is already quite long.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: df95474885aeaaa77eeea4c4b31a92b58fc2a67c
Component: engine
2016-02-29 16:34:42 -05:00
2180969e3a Merge pull request #20107 from calavera/client_auth_store
Client credentials store.
Upstream-commit: 29ce086e38384c54f6f2d8f09578a75c4c9d9593
Component: engine
2016-02-29 22:31:34 +01:00
f3c9f69224 Merge pull request #20307 from HuKeping/trust
Refactor trust push
Upstream-commit: 1ba0358a10e6ad61832a47ac2f99dda7a7d57429
Component: engine
2016-02-29 11:12:09 -08:00
8a7585ce8e Client credentials store.
This change implements communication with an external credentials store,
ala git-credential-helper. The client falls back the plain text store,
what we're currently using, if there is no remote store configured.

It shells out to helper program when a credential store is
configured. Those programs can be implemented with any language as long as they
follow the convention to pass arguments and information.

There is an implementation for the OS X keychain in https://github.com/calavera/docker-credential-helpers.
That package also provides basic structure to create other helpers.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: cf721c23e715e545eccf8484e145c2d18d6a6a23
Component: engine
2016-02-29 13:01:31 -05:00
26d7a7de66 Fix client-side race in docker stats
Subscribe to events and monitor for new containers before the initial
listing of currently running containers.

This fixes a race where a new container could appear between the first
list call but before the client was subscribed to events, leading to a
container never appearing in the output of `docker stats`.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 3041aa53efbbfddbc10a66027d973bd353e3b525
Component: engine
2016-02-28 18:44:23 -08:00
1063341f9e Messaging both succeed and failure about the signing
It would be good to add a clearer failure or succeed message.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 1a6866273697361f33ec908f51cf0e071a36b69d
Component: engine
2016-02-27 15:46:41 +08:00
c1ea49044b Refactor trust push
Unlike the untrusted push without an explicit tag will push all
tags for that repo, the trusted push would expect an explicit tag.

So that the code that attempts to do smart logic around signing multiple
tags should be removed.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 5dddf7e98e3296ddec07e104ea829bebdb15d98d
Component: engine
2016-02-27 15:46:35 +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
045d5355a7 Make server middleware standalone functions.
Removing direct dependencies from the server configuration.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 1ba44a832f6aae811dfc6235287dd5b99e8aa94c
Component: engine
2016-02-24 14:48:52 -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
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
b49176ac83 Fixed logrus client/server mismatch debug msg
Signed-off-by: Brent Salisbury <brent@docker.com>
Upstream-commit: a499ad8e4e596d21167347437a2ca3098cbadc45
Component: engine
2016-02-22 23:36:33 -05:00
583166cc10 consistent variable names in api/server/router
- banish 'daemon'

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
Upstream-commit: 90215065024aea1001e42e7a427248630b4a1115
Component: engine
2016-02-22 10:53:47 -08: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
34184bd076 Merge pull request #20383 from HackToday/addsort
Make network ls output order
Upstream-commit: 0e72550c5b27704ac1ec043302fe2aaebe3b1956
Component: engine
2016-02-19 15:42:48 -05:00
033a056f03 Merge pull request #20389 from HackToday/addvolumesupport
Make volume ls output order
Upstream-commit: 48701888c216868379ee430e041f7a9568970117
Component: engine
2016-02-19 15:41:34 -05: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
58f7113a32 Merge pull request #20365 from calavera/remove_debug_from_server
Remove all docker debugging knowledge from the server.
Upstream-commit: 1fb144cb230fb5e26a19263bd0a159f3c9bd700b
Component: engine
2016-02-18 12:06:23 -05:00
880238a939 Make volume ls output order
Fixes: #20384
Add order support for volume ls to make it easy
to external users to consume.

Signed-off-by: Kai Qiang Wu(Kennan) <wkqwu@cn.ibm.com>
Upstream-commit: 60ffd6c880024c5ab3ad96dc79b01dccd23dd766
Component: engine
2016-02-17 09:01:27 +00:00
f8aea9f057 Make network ls output order
Fixes: #20328
We sort network ls output with incresing order,
it may make output more easy to consume for users.

Signed-off-by: Kai Qiang Wu(Kennan) <wkqwu@cn.ibm.com>
Upstream-commit: 838ed1866bf285759efdc01a97ae837f0f1c326a
Component: engine
2016-02-17 04:35:36 +00:00
c165bf9e34 Bugfix: the actions when pull from notary should not contains push
Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 6b8a2a0fe47b218aaba3050c1f376941e4773313
Component: engine
2016-02-17 10:36:09 +08:00
ddc0af4e6a Merge pull request #19986 from vishh/expose-root-dir
Expose docker's root directory by default as part of `docker info`.
Upstream-commit: 80187df25708782db20846e63aef7ddb0419c7cf
Component: engine
2016-02-16 12:57:57 -08:00
ab0cee0d5e Remove all docker debugging knowledge from the server.
It should be explicitly told whether to enable the profiler or not.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: e8f569b3246b3ce4e765b0aafe53b6d70d12a2d6
Component: engine
2016-02-16 14:11:16 -05:00
9315309e4c Expose docker's root directory by default as part of docker info.
Signed-off-by: Vishnu kannan <vishnuk@google.com>
Upstream-commit: 6a3176d4fee3e747ecb6b2d27ab2eb68471f3f8f
Component: engine
2016-02-16 10:40:15 -08:00
1f2b78374a Merge pull request #20278 from aaronlehmann/build-authconfig
Pass authentication credentials through to build
Upstream-commit: 64a4605892d8bcc43c73948349bcfede14eb8c3a
Component: engine
2016-02-12 18:37:49 -05:00
2298d51345 Lower warning about old client to a debug
Ideally I would love to just remove this check entirely because its
seems pretty useless.  An old client talking to a new server isn't
an error condition, nor is it something to even worry about - its a normal
part of life.  Flooding my screen (and logs) with a warning that isn't
something I (as an admin) need to be concerned about is silly and a
distraction when I need to look for real issues.  If anything this should
be printed on the cli not the daemon since its the cli that needs to be
concerned, not the daemon.

However, since when you debug an issue it might be interesting to know the
client is old I decided to pull back a little and just change it from
a Warning to a Debug logrus call instead.

If others want it removed I still do that though  :-)

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 059ad5d0a975ab4970fe0be45a79ffa0ef35e366
Component: engine
2016-02-12 10:53:40 -08:00
5d5044b24f Pass authentication credentials through to build
In Docker 1.10 and earlier, "docker build" can do a build FROM a private
repository that hasn't yet been pulled. This doesn't work on master. I
bisected this to https://github.com/docker/docker/pull/19414.
AuthConfigs is deserialized from the HTTP request, but not included in
the builder options.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 6fed46aeb97943315aed12f2dc62565f7bcc53dc
Component: engine
2016-02-12 10:50:16 -08:00
7f66344ec0 Add docs for --ipv6 option, also add --internal as appropriate
Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
Upstream-commit: d736a9d2c3758fcc4eac0b62e9c7b128388021c1
Component: engine
2016-02-12 01:42:15 +00: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
cfb6f193ab Expose bridge IPv6 setting to docker network inspect
Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
Upstream-commit: dfb00652aa801ecd7fcc3bf492434bd140d9d1ea
Component: engine
2016-02-11 22:13:47 +00:00
9e5008a270 Merge pull request #20239 from calavera/remove_server_port_allocation
Move listeners and port allocation outside the server. 
Upstream-commit: 02a37a281cb1200747e10bef7409ac1e65bc24f4
Component: engine
2016-02-11 13:50:48 -08:00
e56e27b666 Move getContext… function to builder package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 312f5e435bed2ca45477dc9e4713d35aabe37075
Component: engine
2016-02-11 20:59:59 +01:00
c9c9d43ade Move listeners and port allocation outside the server.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 34c29277c2c1fd1d1adc4409dc7075685f681de4
Component: engine
2016-02-11 14:42:49 -05: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
5c97141da9 Remove daemon dependency from api/server.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 1af76ef5970202bdbc7024d825c0fcfcc4ec6ede
Component: engine
2016-02-10 15:16:59 -05:00
def405f4e4 Merge pull request #20165 from vdemeester/move-validatecontextdirectory-to-builder
Move validateContextDirectory to builder package.
Upstream-commit: e18eb6ef394522fa44bce7a3b9bb244d45ce9b56
Component: engine
2016-02-10 08:35:25 -08:00
0a01ad0c9c Merge pull request #19835 from ncdc/resize-after-attach
Move resize after attaching
Upstream-commit: c2ebdb3e573cbbb053eb4644119f3c99a6111bdc
Component: engine
2016-02-10 15:32:51 +01:00
566c96f73b Move validateContextDirectory to builder package.
This feels like it's where it belongs and it makes it exported
again (which is needed for libcompose that was using it before 1.10).

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: fc6122a947f9eb9fc2f54fb8ba3b9da4531a6b99
Component: engine
2016-02-09 22:19:09 +01:00
26a1a8c70f cleanup attach api calls
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: a77b7dd2278106b9081d0ef2260fbeea790a91ef
Component: engine
2016-02-09 14:26:51 -05:00
571e442f4c Move stream flushes to backend
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: ae4ee974e80c5d650fdcbc0a6f5ab3245a7f1689
Component: engine
2016-02-09 14:25:02 -05:00
b8acba957f Move backend types to their own package.
- Remove duplicated structs that we already have in engine-api.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 06d8f504f7b1883f490b5deda5a30ef9acd99f95
Component: engine
2016-02-08 12:42:17 -05:00
353831dee0 Decouple the "container" router from the actual daemon implementation.
This is done by moving the following types to api/types/config.go:
  - ContainersConfig
  - ContainerAttachWithLogsConfig
  - ContainerWsAttachWithLogsConfig
  - ContainerLogsConfig
  - ContainerStatsConfig

Remove dependency on "version" package from types.ContainerStatsConfig.
Decouple the "container" router from the "daemon/exec" implementation.

* This is done by making daemon.ContainerExecInspect() return an interface{}
value. The same trick is already used by daemon.ContainerInspect().

Improve documentation for router packages.
Extract localRoute and router into separate files.
Move local.router to image.imageRouter.

Changes:
  - Move local/image.go to image/image_routes.go.
  - Move local/local.go to image/image.go
  - Rename router to imageRouter.
  - Simplify imports for image/image.go (remove alias for router package).

Merge router/local package into router package.
Decouple the "image" router from the actual daemon implementation.
Add Daemon.GetNetworkByID and Daemon.GetNetworkByName.
Decouple the "network" router from the actual daemon implementation.

This is done by replacing the daemon.NetworkByName constant with
an explicit GetNetworkByName method.

Remove the unused Daemon.GetNetwork method and the associated constants NetworkByID and NetworkByName.

Signed-off-by: Lukas Waslowski <cr7pt0gr4ph7@gmail.com>
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: dd93571c69cc5284f695a21d5504fb57b1a4891a
Component: engine
2016-02-08 11:30:57 -05:00
311dc4f8a6 Add progress bar to docker load
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: fae09e25698006a190d14fe64f1576f68431fabf
Component: engine
2016-02-05 02:24:23 -05:00
36dd8337c1 Merge pull request #19357 from chenchun/internal
Display `internal` flag on `network inspect`
Upstream-commit: 18204ea61690797930efcf2d0a638961664ba0df
Component: engine
2016-02-04 16:31:12 -05:00
32fac24f32 Apply context changes to the client.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: fe53be4e1785ab4d8cadf246e5f2de419f337adc
Component: engine
2016-02-04 13:59:57 -05:00
e109e016c1 Display internal flag on network inspect
Also adds internal network tests for bridge network

Signed-off-by: Chun Chen <ramichen@tencent.com>
Upstream-commit: c199506b59f60ac456cb0448ddd86e6dec92bc0a
Component: engine
2016-02-04 15:28:37 +08:00
6e2fab11f7 Remove unnecessary call to /info
Avoid using the `/info` endpoint in the `login` and `logout` workflows
when the Registry endpoint is overriden by the user through the command
line.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 243d0d6bbe0376fb43a2718710f31bb068d22168
Component: engine
2016-02-03 13:10:25 -08:00