Граф коммитов

179 Коммитов

Автор SHA1 Сообщение Дата
David Calavera 141aaae18f Fix implicit conversion of transport sender in canceler_14.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-03 19:36:14 -05:00
David Calavera 96a53a0388 Export ParseHost function, so clients can use it to configure their transport.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-03 18:23:46 -05:00
David Calavera 78e365ecbd Use Sockets.ConfigureTransport to remove duplicated code.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-03 18:11:54 -05:00
Amit Krishnan c5b2903e18 Set DefaultDockerHost on Solaris
Signed-off-by: Amit Krishnan <krish.amit@gmail.com>
2016-02-03 13:08:56 -08:00
John Howard 8253d8a09d Windows: Isolation word fix
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-02-03 10:48:04 -08:00
David Calavera c7030d5e5c Merge pull request #69 from jstarks/windows_npipe_transport
Windows: add support for named pipe transport
2016-02-02 09:47:03 -08:00
Alexander Morozov be6e1ef57e Merge pull request #35 from calavera/cancellable_ops
Make streaming operations cancellable.
2016-02-02 09:23:27 -08:00
John Starks bb91ebe407 Windows: add support for named pipe transport
This does not yet change the default to use named pipes.

Signed-off-by: John Starks <jostarks@microsoft.com>
2016-02-01 20:06:40 -08:00
David Calavera 7c188769a3 Add examples of cancelling client requests.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-01 16:59:20 -05:00
David Calavera 8303c31936 Abstract cancelation logic to take a transport.Sender.
Use an interface rather than a direct struct.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-01 16:33:44 -05:00
David Calavera 535f336b5e Make streaming operations cancellable.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-01 16:33:44 -05:00
David Calavera 10c448c824 Add basic container create test to verify name settings.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-29 12:38:12 -05:00
David Calavera ba33f314f0 Add test for Info with a mocked client.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-28 18:31:24 -05:00
David Calavera 7d239010fc Abstract the HTTP transport in an interface.
That way the transport protocol is completely mockable for testing.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-28 18:31:24 -05:00
David Calavera e558e63f36 Allow to configure the client with a given http.Client.
- Give more control over the http connection to the library callers.
- Validate the host provided when the client is created.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-28 18:31:24 -05:00
David Calavera f3d1cee74f Revert "Moving Pull Behavior into engine-api to support docker pr#16609"
This reverts commit 8c89d35a31.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-25 13:35:38 -05:00
David Calavera 57dd6a77ab Merge pull request #51 from calavera/load_default_tls_ca
Make sure the TLS CA is properly loaded by default.
2016-01-25 09:28:08 -08:00
David Calavera 944a42d783 Merge pull request #62 from docker/remove-redundant-nillness-checks
Refactor JSON decoding, reduce defers
2016-01-25 09:27:46 -08:00
David Calavera 53609ac7e2 Merge pull request #60 from cyphar/fix-freebsd-client
client: fix conditional compilation for freebsd
2016-01-25 09:27:20 -08:00
Sebastiaan van Stijn 406d06bcfa Remove duplicated code
This removes duplicated code

Also removed a redundant check if err is nil,
because we returned an "error" or "nil", so
if err is nil, we're good to go as well.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-01-24 23:21:04 -08:00
Sebastiaan van Stijn afc431f600 Refactor JSON decoding, reduce defers
There's no need to check for error-nilness if
we're going to return a "nil" on success.

Also, removed defer statements because they
were no longer needed, and have some
overhead; http://lk4d4.darth.io/posts/defer/

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-01-24 23:16:06 -08:00
Aleksa Sarai bf2c86398b client: fix conditional compilation for freebsd
The DockerDefaultHost was unset on freebsd. Fix this by grouping unix
and not-unix conditional compilation files.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-01-23 20:40:06 +11:00
David Calavera 105be31b63 Make sure the TLS CA is properly loaded by default.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-19 16:56:24 -08:00
Dongluo Chen 31b698aad7 Merge pull request #17 from lindenlab/pull-behavior-docker-pr-16609
docker pr#16609 support: PullBehavior
2016-01-15 17:13:07 -08:00
David Calavera 27d58dc94c Merge pull request #39 from lalyos/default_docker_host
use defaut unix socket if DOCKER_HOST is unset
2016-01-15 09:37:30 -08:00
Don Kjer 8c89d35a31 Moving Pull Behavior into engine-api to support docker pr#16609
Signed-off-by: Don Kjer <don.kjer@gmail.com>

Adding comment to PullBehavior.String()
2016-01-14 22:19:25 +00:00
lalyos 4ab6768fb8 use os specific defaut if DOCKER_HOST is unset
Signed-off-by: lalyos <lalyos@yahoo.com>
2016-01-14 18:07:55 +01:00
David Calavera 22fbf0b4f9 Fix TLS configuration for response hijacking.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-13 19:19:45 -05:00
Tonis Tiigi a4ec5b48ec Change missing image detection for create
Daemon may not respond with the same image name
any more but it may be in a normalized form.
Generally checking for a container name doesn’t 
seem like a good idea because small image names
may match any possible error.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-01-11 12:05:28 -08:00
Madhu Venugopal d1c2a8739c an option to disconnect an endpoint from a network forcefully
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-01-09 14:54:49 -08:00
David Calavera ee2fe708a6 Send only the endpoint settings to connect to a network.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-07 20:41:50 -05:00
David Calavera 7bff8189ca Ensure that Client always implement APIClient.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-07 19:37:40 -05:00
Alessandro Boch 85a5829518 Changes to support specify IP addresses for the container
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-01-07 16:13:55 -08:00
Vincent Demeester 2ecc23fbfe Add an interface defining all the API methods
Backported from docker/docker project. Makes it easy and readable to
know what methods to implement to be considered as a complete docker client.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-01-07 23:37:02 +01:00
Vincent Demeester 314581c321 Add a specific config for the update command
This allows to define clearly what is mutable or not in a container.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-01-07 22:45:54 +01:00
David Calavera 46be3b84c2 Fix ImageBuilderOptions.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-05 16:44:51 -05:00
David Calavera 0c77b4b120 Fix repository imports and packages.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-04 18:26:13 -05:00
Vincent Demeester 556a365760 Implement configurable detach key
Implement configurable detach keys (for `attach`, exec`, `run` and
`start`) using the client-side configuration

- Adds a `--detach-keys` flag to `attach`, `exec`, `run` and `start`
  commands.
- Adds a new configuration field (in `~/.docker/config.json`) to
  configure the default escape keys for docker client.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-01-03 23:03:39 +01:00
Qiang Huang aa03c9d378 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
Antonio Murdaca 1c4dcce1c9 Merge pull request #18878 from calavera/conditional_load_response
Make `docker load` to output json when the response content type is json.
2015-12-24 01:11:54 +01:00
Zhang Wei c9593f2a55 Add filter for `network ls` to hide predefined net
Add filter support for `network ls` to hide predefined network,
then user can use "docker network rm `docker network ls -f type=custom`"
to delete a bundle of userdefined networks.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2015-12-23 13:26:40 +08:00
David Calavera fc0f6a4e28 Make `docker load` to output json when the response content type is json.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-22 19:00:27 -05:00
David Calavera 23b784d9d9 Move Config and HostConfig from runconfig to types/container.
- Make the API client library completely standalone.
- Move windows partition isolation detection to the client, so the
  driver doesn't use external types.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-22 13:34:30 -05:00
David Calavera 427e1d7622 Remove usage of runconfig.ConvertKVStringsToMap in the API client library.
It's a very simple function that we can duplicate.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-22 13:31:46 -05:00
David Calavera 33d0f3a2c1 Move ExecConfig to types.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-22 13:31:46 -05:00
David Calavera 427068e863 Add godoc comment about client tls verification.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-21 12:55:37 -05:00
David Calavera a8a4b4e7c4 Remove api client lib dependency on tlsconfig and sockets packages.
- Let consumers to configure the http transport initially and apply or
  defaults on top.
- Add function to initialize a new client based on environment
  variables, useful for integrators.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-17 19:04:49 -05:00
David Calavera b05130e0d8 Merge pull request #15964 from duglin/APIVersion
Add a DOCKER_API_VERSION env var
2015-12-16 14:23:47 -08:00
David Calavera 93c8e1da24 Merge pull request #18682 from calavera/replace_units_package
Replace pkg/units with docker/go-units.
2015-12-16 10:48:59 -08:00
David Calavera 79e8cc8b7d Replace pkg/units with docker/go-units.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-16 12:26:49 -05:00
Antonio Murdaca 44e5609af2 api: client: lib: fix go vet
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2015-12-16 12:00:48 +01:00
David Calavera f74d805310 Move filters package to the API.
These filters are only use to interchange data between clients and daemons.
They don't belong to the parsers package.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-15 18:13:26 -05:00
David Calavera c936f7b149 Merge pull request #18685 from calavera/remove_timeutils
Move timeutils functions to the only places where they are used.
2015-12-15 15:11:18 -08:00
David Calavera 270fabbc86 Move timeutils functions to the only places where they are used.
- Move time json marshaling to the jsonlog package: this is a docker
  internal hack that we should not promote as a library.
- Move Timestamp encoding/decoding functions to the API types: This is
  only used there. It could be a standalone library but I don't this
it's worth having a separated repo for this. It could introduce more
complexity than it solves.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-15 14:56:14 -05:00
Daniel Nephin a978ca8abe Move registry.SearchResult types to api/types/registry.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-12-15 11:44:20 -05:00
Arnaud Porterie d8f8d5672c Merge pull request #18650 from calavera/remove_httputils_dep_from_api
Remove httputils dependency from API client lib.
2015-12-14 20:51:53 -08:00
Vincent Demeester ad31936c87 Merge pull request #18644 from calavera/remove_timeout_func_dependency_from_api_lib
Remove timeout shared function.
2015-12-14 23:05:29 +01:00
David Calavera 1954f6a039 Remove httputils dependency from API client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-14 16:48:59 -05:00
Doug Davis c170a0c70f Add a DOCKER_API_VERSION env var
Closes: #11486

Just for @ahmetalpbalkan  :-)

Fixed some comment formatting too while in there.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-12-14 12:45:34 -08:00
David Calavera 77887e963f Merge pull request #18637 from dnephin/move_auth_config
Move more api types to api/types package
2015-12-14 11:53:30 -08:00
David Calavera c8444188c1 Remove timeout shared function.
Handle timeouts when it's necessary based on a Timeout interface.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-14 14:24:21 -05:00
David Calavera 8b71d1ca05 Force API versioning in the client library.
Remove dependencies on docker's version packages.
Allow empty version as a fallback to latest version.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-14 12:06:42 -05:00
Daniel Nephin 420dfebd24 Move AuthConfig to api/types
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-12-14 11:22:01 -05:00
David Calavera f0a5760b4b Move client version to the docker cli.
This removes the dockerversion dependency from the client library.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-11 19:03:33 -05:00
David Calavera 21f48252f3 Make the commit configuration to be a typed struct rather than accepting a string.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:06:58 -05:00
David Calavera e00783ec7e Implement all inspect commands with the new inspector interface.
It makes the behavior completely consistent across commands.
It adds tests to check that execution stops when an element is not
found.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:05:01 -05:00
David Calavera d7b2b0250c Remove old http from the docker cli.
Everything has been ported to the client library 🎉

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:05:00 -05:00
David Calavera 7784a353b7 Implement docker search with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:05:00 -05:00
David Calavera 433055726b Implement docker resize with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:05:00 -05:00
David Calavera cd3034f023 Implement docker inspect with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:05:00 -05:00
David Calavera 576337705d Implement docker push with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:05:00 -05:00
David Calavera 0c3f68b576 Implement docker pull with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:05:00 -05:00
David Calavera 39fa453fb0 Implement docker stats with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:05:00 -05:00
David Calavera 4c6bc46188 Implement docker exec with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:59 -05:00
David Calavera 057c83d7fc Implement docker start with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:59 -05:00
David Calavera 57d0053104 Implement docker attach with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:59 -05:00
David Calavera abad24b6bc Lowercase http method functions.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:59 -05:00
David Calavera 6f0aa31703 Change references to query values.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:59 -05:00
David Calavera 9a40f025a5 Create interface that clients that talk to the api must fulfill.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:58 -05:00
David Calavera e05f642f68 Fix client lib errors documentation.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:58 -05:00
David Calavera 8407ca14a0 Implement docker volume with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:58 -05:00
David Calavera 5108572859 Use ensureReaderClosed consistently to close a response body reader.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:58 -05:00
David Calavera 02f89bf0b4 Implement getExitCode with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:58 -05:00
David Calavera 6a87d5269e Implement docker wait with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:58 -05:00
David Calavera 3ea953f7e6 Implement docker version with standalone client lib.
Use Go template definitions for default format.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:58 -05:00
David Calavera 4b208eefc7 Implement docker unpause with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:57 -05:00
David Calavera ba49afc48e Implement docker top with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:57 -05:00
David Calavera fe83a34476 Implement docker tag with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:57 -05:00
David Calavera 08e8f24eb1 Implement docker stop with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:57 -05:00
David Calavera f68d02904b Implement docker save with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:56 -05:00
David Calavera 8a8b54bffd Implement docker rmi with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:56 -05:00
David Calavera ae37d7feda Implement docker remove with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:56 -05:00
David Calavera ab6ae19afe Implement docker restart with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:56 -05:00
David Calavera 814494d086 Implement container rename with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:56 -05:00
David Calavera 183592287c Implement docker ps with standanlone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:56 -05:00
David Calavera 307422005d Implement docker pause with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:56 -05:00
David Calavera ddfb98d789 Implement docker network with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:55 -05:00
David Calavera a820704451 Implement docker logs with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:55 -05:00
David Calavera 42c74cea08 Implement docker login with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:55 -05:00
David Calavera 09687c0f0c Implement docker load with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:55 -05:00