Commit Graph

45 Commits

Author SHA1 Message Date
Aarni Koskela d50cc429c2 Enable Ruff I (import sort), autofix
Signed-off-by: Aarni Koskela <akx@iki.fi>
2024-01-03 21:28:56 +02:00
Milas Bowman 26e07251d4 chore: fix lint issues
ruff ruff ruff!

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-11-20 16:11:06 -05:00
Mariano Scazzariello 7752996f78
Replace `network_config` with a dict of EndpointConfig
- Renamed parameter from `network_config` to `networking_config` to be more semantically correct with the rest of the API.
2023-09-30 00:20:44 +02:00
Mariano Scazzariello 0318ad8e7e
Fix blank line
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-05-15 14:51:44 +02:00
Mariano Scazzariello e011ff5be8
More sanity checking of EndpointConfig params
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-05-07 12:40:08 +02:00
Mariano Scazzariello a18f91bf08
Fix long line
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-05-07 11:49:59 +02:00
Mariano Scazzariello a662d5a305
Fix pytests
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-05-07 11:47:07 +02:00
Milas Bowman aca129dd69 Merge branch 'master'
(Old PR unintentionally went to the `master` branch.)
2023-01-27 09:27:42 -05:00
Mariano Scazzariello ee9151f336
client: add `network_driver_opt` to container run and create (#3083)
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-01-27 09:26:21 -05:00
loicleyendecker 82cf559b5a
volume: do not strip trailing characters from names (#3073)
Only remove `:ro` or `:rw` suffixes in their entirety; do not
strip arbitrary `r` / `o` / `w` / `:` characters individually.

Signed-off-by: Loïc Leyendecker <loic.leyendecker@gmail.com>
2022-12-02 14:48:04 -05:00
David d69de54d7c
api: add cgroupns option to container create (#2930)
Signed-off-by: David Otto <ottodavid@gmx.net>
2022-07-29 14:04:47 -04:00
Felix Fontein 1a4cacdfb6
api: add platform to container create (#2927)
Add platform parameter for container creation/run

Signed-off-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Co-authored-by: Milas Bowman <milas.bowman@docker.com>
2022-07-29 13:57:30 -04:00
Ben Fasoli 23cf16f03a
client: use 12 character short IDs (#2862)
Use 12 characters for Docker resource IDs for
consistency with the Docker CLI.

Signed-off-by: Ben Fasoli <benfasoli@gmail.com>
2022-07-29 09:06:22 -04:00
aiordache cec152db5f Set image default tag on pull
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-09-16 17:36:50 +02:00
Niklas Saari 51fd6dd1ce
Disable compression by default when using get_archive method
Signed-off-by: Niklas Saari <niklas.saari@tutanota.com>
2020-02-26 23:09:38 +02:00
Hannes Ljungberg 523371e21d Move volume_driver to RUN_HOST_CONFIG_KWARGS
Fixes #2271

Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
2019-03-23 20:57:23 +01:00
Joffrey F a579e9e205 Remove use_config_proxy from exec. Add use_config_proxy docs to DockerClient
Signed-off-by: Joffrey F <joffrey@docker.com>
2019-01-09 14:45:13 -08:00
Corentin Henry 2c4a8651a8 By default, disable proxy support
This is to avoid a breaking change

Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
2019-01-09 11:30:58 -08:00
Joffrey F ee6ec4c6e8 Merge branch 'master' of https://github.com/little-dude/docker-py into little-dude-master 2018-11-30 14:48:19 -08:00
Joffrey F c53423f118 Update DockerClient.images.pull to always stream response
Also raise a warning when users attempt to specify the "stream" parameter

Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-28 11:27:04 -08:00
adw1n a74d546864 Fix pulling images with `stream=True`
Pulling an image with option `stream=True` like this:
```
client.api.pull('docker.io/user/repo_name', tag='latest', stream=True)
```
without consuming the generator oftentimes results in premature drop of the connection. Docker daemon tries to send progress of pulling the image to the client, but it encounters an error (broken pipe) and therefore cancells the pull action:
```
Thread 1 "dockerd-dev" received signal SIGPIPE, Broken pipe.
ERRO[2018-09-03T05:12:35.746497638+02:00] Not continuing with pull after error: context canceled
```
As described in issue #2116, even though client receives response with status code 200, image is not pulled.

Closes #2116

Signed-off-by: Przemysław Adamek <adw1n@users.noreply.github.com>
2018-11-28 11:27:04 -08:00
Corentin Henry 5f157bbaca implement stream demultiplexing for exec commands
fixes https://github.com/docker/docker-py/issues/1952

Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
2018-11-27 17:01:48 -08:00
Marco Trillo 098318ad95 Add support for `uts_mode` parameter in `Client.create_host_config`.
This parameter allows to set the UTS namespace of the container, as in
the `--uts=X` Docker CLI parameter:
<https://docs.docker.com/engine/reference/run/#uts-settings---uts>
The only allowed value, if set, is "host".

Signed-off-by: Marco Trillo <martri@arantia.com>
Signed-off-by: Diego Alvarez <dyako.developer@gmail.com>
2018-06-29 14:54:49 +02:00
Joffrey F 94e9108441 Add ignore_removed param to containers.list() to control whether to
raise or ignore NotFound

Signed-off-by: Joffrey F <joffrey@docker.com>
2018-04-25 17:55:16 -07:00
Joffrey F 581ccc9f7e Add chunk_size parameter to data downloading methods (export, get_archive, save)
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-14 16:07:19 -08:00
Joffrey F 7fabcdaa4c Update wait to always return a dict
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-31 16:52:26 -08:00
Joffrey F 209ae2423d Correctly parse volumes with Windows paths
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-31 15:12:15 -08:00
Joffrey F 3422211309 Use pytest asserts
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-30 14:26:24 -08:00
Joffrey F 6e6eaece81 Return tuple instead of dict in exec_run
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-26 14:21:23 -08:00
Joffrey F b0cc4b5520 Merge branch 'add_exit_code_to_exec_run' of https://github.com/hnq90/docker-py into hnq90-add_exit_code_to_exec_run 2018-01-26 14:13:15 -08:00
Joffrey F abd60aedc7 Bump default API version to 1.35
Add ContainerSpec.isolation support
Add until support in logs
Add condition support in wait
Add workdir support in exec_create

Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-26 13:56:01 -08:00
Joffrey F f95b958429 Add support for experimental platform flag in build and pull
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-23 16:59:09 -08:00
Joffrey F 6b8dfe4249 Retrieve container logs before container exits / is removed
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-12-14 16:53:44 -08:00
HuyNQ 436306f09d
Add exit code to exec_run
Signed-off-by: HuyNQ <huy@huynq.net>
2017-11-13 14:11:21 +07:00
David Steines 6b59dc6271 Allow detach and remove for api version >= 1.25 and use auto_remove when both are set. Continue raising an exception for api versions <1.25.
Signed-off-by: David Steines <d.steines@gmail.com>
2017-08-17 13:38:40 -07:00
Joffrey F 95297dc2e7 Replace erroneous networks argument in containers.run with singular
network equivalent.

Small docfixes

Signed-off-by: Joffrey F <joffrey@docker.com>
2017-05-12 14:28:27 -07:00
Joffrey F c6ddea469f Include tag in images.get after pulling if provided separately
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-05-09 12:24:40 -07:00
Joffrey F 13dfb13858 Merge branch 'add-env-support-to-exec' of https://github.com/TomasTomecek/docker-py into TomasTomecek-add-env-support-to-exec
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-05-02 16:38:40 -07:00
Dan Liew 2a0a7adece Fix typo s/CpuSetCpus/CpusetCpus/
According to Docker's API documentation [1]. The parameter name
is `CpusetCpus` not `CpuSetCpus`.

[1] https://docs.docker.com/engine/api/v1.25/#operation/ContainerCreate

Signed-off-by: Dan Liew <daniel.liew@imperial.ac.uk>
2017-05-01 14:56:40 +01:00
Tomas Tomecek 4633dac580 exec: add support for `Env`
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2017-04-29 08:56:51 +02:00
Frank Sachsenheim 659090fc99 Adds an 'image' property to the container model
Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
2017-04-15 15:46:52 +02:00
Frank Sachsenheim 1cd56b9f0c Adds a 'labels' property to the container model
The Docker API seems to respond with a 'null' value for the 'Labels'
attribute from containers that were created with older Docker versions.
An empty dictionary is returned in this case.

Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
2017-04-15 15:46:52 +02:00
Ben Firshman f83993de0a
Fix passing volumes to run with no host path
Technically we shouldn't be passing them as binds, but the daemon
doesn't seem to mind.

Fixes #1380

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2017-02-07 19:22:36 +01:00
Ben Firshman 956fe1cac1
Fix volume path passed by run to create_container
Seems like this is pretty much ignored by Docker, so it wasn't
causing any visible issues, except when a volume name was used
instead of a path.

Also, added integration tests.

Ref #1380

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2017-02-07 19:22:35 +01:00
Ben Firshman 1984f68730
Add new user-focused API
See #1086

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:05:43 +00:00