Commit Graph

48 Commits

Author SHA1 Message Date
49adb54d71 Remove duplicate calls for getting an APIClient
Remove request.SockRequest
Remove request.SockRequestHijack
Remove request.SockRequestRaw()
Remove deprecated ParseHost
Deprecate and unexport more helpers

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 0a91ba2d8cfe16df0ba37c1e283c8e3dbbb086d4
Component: engine
2018-02-20 17:27:24 -05:00
180ce35066 Improve docstrings and small cleanup in client
Use client instead of helpers for TLS in integration test

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: a68ae4a2d95b1ff143025a435195af0f1ab30ace
Component: engine
2018-02-20 15:15:02 -05:00
d92fe4f6a1 Fix TLS from environment variables in client
A recent change accidently caused any TLS configuration in FromEnv to be
ignored. This change alters WithHost to create a new http client only if
one doesn't already exist, and otherwise applies the logic to the
transport on the existing client. This preserves the TLS configuration
that might already be on the client.

Signed-off-by: Drew Erny <drew.erny@docker.com>
Upstream-commit: 80904e9571e7724328160c97ede6a71864f3c06a
Component: engine
2018-02-09 15:29:32 -08:00
0590bb4b31 Introduce NewClientWithOpts func to build custom client easily
This allows to create a client with default values and override those
using functors. As an example, `NewEnvClient()` becomes
`NewClientWithOpts(FromEnv)` ; and if you want a different api version
for this client : `NewClientWithOpts(FromEnv, WithVersion("1.35"))`

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 772edd020cc784913973387b00c4d0c526a10a26
Component: engine
2018-02-08 15:26:24 +01:00
be83c11fb0 Add canonical import comment
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4f0d95fa6ee7f865597c03b9e63702cdcb0f7067
Component: engine
2018-02-05 16:51:57 -05:00
747a47b477 Fix version comparison when negotiating the the API version
Signed-off-by: Yu-Ju Hong <yjhong@google.com>
Upstream-commit: 4b6ec10b07c14e7fff1cc51156b6d954147f826f
Component: engine
2017-09-27 18:42:02 -07:00
2c45bc6a92 Merge pull request #34770 from dnephin/fix-client-with-empty-id
Fix volume inspect with empty ID
Upstream-commit: 63a9ea58eb4c704ed7d7dab950f12f708cf220f7
Component: engine
2017-09-11 07:01:50 -07:00
5899c64938 Fix volume inspect with empty ID
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 5ac298fd0e5c065483653970be587626026971c2
Component: engine
2017-09-07 13:46:23 -04:00
980d05f2ea Cleanup client/ interface
- Remove ParseLogDetails, this is not part of the client. Moved to docker/cli
- Deprecate ParseHost and replace with ParseHostURL
- Deprecate redundant IsErr helpers

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 54242cd067c234960d1295a67271475f9d099f22
Component: engine
2017-09-07 12:32:38 -04:00
417e5624cd Fix requests for docker host ending with slash
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 823e88d4c4298c38130b9a387a45c47cf957a931
Component: engine
2017-08-11 10:47:02 -07:00
a66a5d1d6a fix client.Transport
`client.Transport` is `http.Client.Transport` just has `RoundTripper()`. Not `http.Transport`. So we cannot convert it here.

For a mock test, I can play with this https://play.golang.org/p/gs7_QrL9-Y

Signed-off-by: wrfly <mr.wrfly@gmail.com>
Upstream-commit: e345cd12f96b3985257652b606c8463a5772944b
Component: engine
2017-08-03 17:14:26 +08:00
643654c2f0 Spelling fixes
* additional
* ambiguous
* anonymous
* anything
* application
* because
* before
* building
* capabilities
* circumstances
* commit
* committer
* compresses
* concatenated
* config
* container
* container's
* current
* definition
* delimiter
* disassociates
* discovery
* distributed
* doesnotexist
* downloads
* duplicates
* either
* enhancing
* enumerate
* escapable
* exactly
* expect
* expectations
* expected
* explicitly
* false
* filesystem
* following
* forbidden
* git with
* healthcheck
* ignore
* independent
* inheritance
* investigating
* irrelevant
* it
* logging
* looking
* membership
* mimic
* minimum
* modify
* mountpoint
* multiline
* notifier
* outputting
* outside
* overridden
* override
* parsable
* plugins
* precedence
* propagation
* provided
* provides
* registries
* repositories
* returning
* settings
* should
* signals
* someone
* something
* specifically
* successfully
* synchronize
* they've
* thinking
* uninitialized
* unintentionally
* unmarshaling
* unnamed
* unreferenced
* verify

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 39bcaee47b8a284a46b761afe218ba7deda0d482
Component: engine
2017-07-03 13:13:09 -07:00
1a311235ba Always perform version-negotiation
If a client is initialized without a specific
version set, version negotiation would not be
functional.

This patch changes the behavior to always
perform version negotation (if called), in
which case the "current" (maximum supported
API version) is used as a default.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 5975dc4b4b8a6fa2e0edd1f1b113e7f66dad732b
Component: engine
2017-06-29 22:24:49 -07:00
24b6b491fa pull client API version negotiation out of the CLI and into the client
Signed-off-by: Royce Remer <royceremer@gmail.com>
Upstream-commit: 5f1d94e569592fc2680f8661e16d0e5b02e82492
Component: engine
2017-06-20 22:58:16 -07:00
6f84604b78 client: Use string concatenation instead of Sprintf
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 44c9ccc069c1bfda25ad6fb5932eeeceaa8de491
Component: engine
2017-06-02 14:01:57 +02:00
4a211248b9 client: Expose DaemonHost to client users
This commit exposes `Client.host` as `Client.DaemonHost()`
This allows users of the client, a CLI for example, to query the Host
that the client is attempting to contact and vary their behaviour
accordingly. For example, to allow client-side configuration of
HTTP proxy settings for a number of different docker hosts.

Signed-off-by: Dave Tucker <dt@docker.com>
Upstream-commit: 6ce6ae1cd11d888e0c8ede20926b86981cee5ce1
Component: engine
2017-05-22 13:25:11 +01:00
9d2b3f6463 Return error on client redirect
From Go 1.8 HTTP client redirect behaviour is changed:
When status code is 301, 307 or 308, the client
automatically converts it to a new HTTP request.

This behaviour change manifests in the client in that
before the 301 was not followed and the client did not generate
an error, but now results in an error message:
"Error response from daemon: page not found."

To fix that a new redirect policy is forced by setting
HTTP Client's CheckRedirect.
That policy is to return an error for any 301, 307 or 308
in the response's status code to a non-GET request.
The error message specifies that the daemon could not
process the request and it is probably due to bad
arguments that were provided by the user.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: eb36d6021618f788012c166a533f1b321cda9695
Component: engine
2017-05-11 15:39:41 +03:00
6446421ffd add missing API changes
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: a7e6d2ca1fd30a6122a65558507135e7079ae6a7
Component: engine
2017-02-19 01:33:43 -08:00
b5e0f7eb0f Change tls to TLS
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
Upstream-commit: 113cae5ba2a0edadadbdf8aea06a52ab6b5f0361
Component: engine
2016-12-20 22:08:07 +08:00
c0414c54e6 client: add accessor methods for client.customHTTPHeaders
Added two methods:

 - *Client.CustomHTTPHeaders() map[string]string
 - *Client.SetCustomHTTPHeaders(headers map[string]string)

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: a754d89b4058d8508cf3cee29f6107b2f93f3001
Component: engine
2016-11-29 09:02:52 +00:00
e5912f7d7e Rename Remote API to Engine API
Implementation of https://github.com/docker/docker/issues/28319

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
Upstream-commit: f0d55cd081c6e8ad2a8222c787d54f9aae15723f
Component: engine
2016-11-22 12:49:38 +00:00
92c12f5ddb Bugfix: set cli.manualOverride when env var not empty
If env var "DOCKER_API_VERSION" is specified by user, we'll set
`cli.manualOverride`, before this, this field is always true due to
wrong logic.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 4d54d30477f2eb0f373fd2301cf4c3ecc1434d62
Component: engine
2016-11-21 17:31:46 +08:00
900e9ed78b Bump API to v1.26
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 9182cf1a8dc592c40d25b628a0a3cfa475c8dcea
Component: engine
2016-11-14 14:24:02 -08:00
d0ebaa81e8 always add but hide experimental cmds and flags
Signed-off-by: Victor Vieux <vieux@docker.com>

update cobra and use Tags

Signed-off-by: Victor Vieux <vieux@docker.com>

allow client to talk to an older server

Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: e98e4a71110fd33852bb755a9b8b4ebc9df904db
Component: engine
2016-11-08 04:55:27 -08:00
4233bef46b client: bump default version to v1.25
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 42a1f7cdf98fc97403ad53695d8ccf884e27e59f
Component: engine
2016-11-07 10:01:28 +01:00
157dbff3e2 Merge pull request #26402 from qudongfang/ensure_client_transport_be_closed
ensure transport.Client be closed
Upstream-commit: 335a3c614917595cb7602adeb7173a0d228f825b
Component: engine
2016-10-26 11:51:51 -07:00
96a5105111 client: deterministically resolve http scheme
The docker client has historically used Transport.TLSClientConfig to set
the scheme for the API client. A recent moved the resolution to use the
http.Transport directly, rather than save the TLSClientConfig state on a
client struct. This caused issues when mutliple calls made with a single
client would have this field set in the http package on pre-1.7
installations. This fix detects the presence of the TLSClientConfig once
and sets the scheme accordingly.

We still don't know why this issue doesn't happen with Go 1.7 but it
must be more deterministic in the newer version.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: 401778b7e2ccfba31190537de847fcdbce745bd2
Component: engine
2016-10-11 15:53:14 -07:00
30c8a928f4 Merge pull request #26804 from stevvooe/clear-tlsconfig-unix-socket
client: pedantic checking of tlsconfig
Upstream-commit: 9bd8c1d3321d1b264e84ff5fba4dc04730c264f3
Component: engine
2016-10-11 15:47:47 -07:00
c2e67963cd Add GoDoc for client package
- Tightened up copy in README
- Make example in README a bit simpler
- Update README to point at GoDoc

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
Upstream-commit: 070038bbc720192338850ff714459fbd5e633853
Component: engine
2016-10-10 09:27:07 +01:00
d96c693644 client: pedantic checking of tlsconfig
Under the convoluted code path for the transport configuration,
TLSConfig was being set even though the socket type is unix. This caused
other code detecting the TLSConfig to assume https, rather than using
the http scheme. This led to a situation where if `DOCKER_CERT_PATH` is
set, unix sockets start reverting to https. There is other odd behavior
from go-connections that is also reproduced here.

For the most part, we try to reproduce the side-effecting behavior from
go-connections to retain the current docker behavior. This whole mess
needs to ripped out and fixed, as this pile spaghetti is unnacceptable.

This code is way to convoluted for an http client. We'll need to fix
this but the Go API will break to do it.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: dc9f5c2ca3cdf8fef5786a80a0a1b0e7c18d4420
Component: engine
2016-09-27 16:27:48 -07:00
a4d47c2309 ensures that transport.Client is closed while using cli.NewClient with *http.Client = nil.
Signed-off-by: qudongfang <qudongfang@gmail.com>
Upstream-commit: 03041f94ba3cff96347f203d137b18c40bbbb83a
Component: engine
2016-09-24 14:32:50 +08:00
7360a13030 client: remove transport package
This package doesn't really seem to do anything of real interest.
Removing it and replacing with a few helper functions. Most of this was
maintaining a fork of ctxhttp to support a mock that was unnecessary.

We could probably do with a further refactor of the client interface.
There is a lot of confusion of between transport, http layer and
application layer that makes for some awkward code. This change
improves the situation to the point where no breaking changes are
introduced.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: 9a072adff3fcd90c4f36214b355ef27b423f0144
Component: engine
2016-09-19 11:19:55 -07:00
60a22c207c Move engine-api client package
This moves the engine-api client package to `/docker/docker/client`.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 7c36a1af031b510cd990cf488ee5998a3efb450f
Component: engine
2016-09-07 11:05:58 -07:00
7882678c17 Make dockerd debuggable
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 0c7eab31577d65f0d33766af533144e358ffe651
Component: engine
2016-04-26 09:35:22 -07:00
dcd6f9747a Build two binaries client and daemon.
Add a proxy to support 'docker daemon'
Fix configFile option, and remove a test that is no longer relevant.
Remove daemon build tag.
Remove DOCKER_CLIENTONLY from build scripts.

Signed-off-by: Daniel Nephin <dnephin@docker.com>

Change docker-daemon to dockerd.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 9e7651db4d464649bc32cf346fdee8c6900ebe0f
Component: engine
2016-04-22 11:26:01 -04:00
621d110d7f Merge dockerd into docker. 'docker -d' runs in daemon mode. For all other commands, docker auto-detects whether to run standalone or to remote-control the daemon
Upstream-commit: 745edc49cdcf0dc02fe714b0772f146fc8a66d23
Component: engine
2013-03-13 00:29:40 -07:00
95b2e5b159 Merged master
Upstream-commit: 86854ffbc5423597d11932eb904cb6fe7dedcac9
Component: engine
2013-03-12 21:53:34 -07:00
547e13b585 Removed interactive mode ('docker -i'). Cool UI experiment but seems more trouble than it's worth
Upstream-commit: d2cba75d5f1e8ceea7f301ef146c571806252fa0
Component: engine
2013-03-12 15:05:41 -07:00
35529bba2c Put back the github.com path for the import
Upstream-commit: 453d49573c91a1c49ffbc54d040145804e38d91e
Component: engine
2013-03-12 11:59:27 -07:00
d6cad8aba4 Merge master within fs
Upstream-commit: 150a4fe7e5aaa5d733130e22eac09cb36ffadd82
Component: engine
2013-03-12 08:33:21 -07:00
ec87b553c7 Automatically remove the rcfile generated by docker -i from /tmp
Upstream-commit: b2de17bf2cfdf90f347109452bcb8763138cff46
Component: engine
2013-03-12 12:12:40 -07:00
b9140244d5 Put back the relative paths for dev purpose
Upstream-commit: 18f4e7e196eb894765094c1291e1a1f6599f4266
Component: engine
2013-03-12 05:17:51 -07:00
c28aedcbf3 Change relative paths to absolute
Upstream-commit: 687d6f25eeb8f4bc505dc9c6c0d9ea305c824e2d
Component: engine
2013-03-11 02:59:52 -07:00
3720d832c1 post-merge repairs
Upstream-commit: 5d6199b9251261216cb096cd919e3cc5eb3efdd6
Component: engine
2013-03-11 07:39:06 -07:00
d2bed9b75c go fmt
Upstream-commit: aa12da6f5076738955b30470639d439a0cbe40f9
Component: engine
2013-02-26 17:26:46 -08:00
27db035d5d Interactive mode preserves existing PATH, to facilitate scripting
Upstream-commit: db4c75f3c1cdbc654595bb3dda5455a93c1b56b4
Component: engine
2013-02-20 14:45:43 -08:00
92f2fe8ab7 'docker start' and 'docker restart': start or restart a container
Upstream-commit: d2885910bda77538eb31b86b10a3dd85ee2abadf
Component: engine
2013-02-14 13:49:05 -08:00
e924ec5591 Moved server and client logic into sub-packages docker/server and docker/client, respectively. The UI is not affected.
Upstream-commit: e1b25e9b084a2375640b811a27b75b89d57666d9
Component: engine
2013-02-13 17:10:00 -08:00