summaryrefslogtreecommitdiff
path: root/docker/models
Commit message (Collapse)AuthorAgeFilesLines
* api: update return type of `diff` method (#3115)John Yang2023-05-051-1/+2
| | | Signed-off-by: John Yang <john.yang20@berkeley.edu>
* api: note the data arg may also be a stream in `put_archive` (#2478)Aarni Koskela2023-02-221-1/+1
| | | Signed-off-by: Aarni Koskela <akx@iki.fi>
* api: add `status` parameter to services list (#3093)Lorin Bucher2023-02-161-0/+2
| | | Signed-off-by: Lorin Bucher <lorin@lbtec.dev>
* Merge branch 'master'Milas Bowman2023-01-271-1/+15
|\ | | | | | | (Old PR unintentionally went to the `master` branch.)
| * client: add `network_driver_opt` to container run and create (#3083)Mariano Scazzariello2023-01-271-1/+15
| | | | | | Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
* | docs: fix wrong command syntax in code annotation (#3081)Maxim Mironyuk2023-01-101-1/+1
| | | | | | Signed-off-by: Maxim Mironyuk <serieznyi@gmail.com>
* | volume: do not strip trailing characters from names (#3073)loicleyendecker2022-12-021-1/+3
| | | | | | | | | | | | 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>
* | api: add support for floats to docker logs params since / until (#3031)Rhiza2022-08-191-4/+5
|/ | | | | | | | Add support for floats to docker logs params `since` / `until` since the Docker Engine APIs support it. This allows using fractional seconds for greater precision. Signed-off-by: Archi Moebius <poerhiz@gmail.com>
* swarm: add support for DataPathPort on init (#2987)Chris Hand2022-08-121-1/+6
| | | | | | Adds support for setting the UDP port used for VXLAN traffic between swarm nodes Signed-off-by: Chris Hand <dexteradeus@users.noreply.github.com>
* swarm: add sysctl support for services (#3029)Quentin Mathorel2022-08-121-0/+3
| | | Signed-off-by: Quentin Mathorel <quentin.mathorel@outlook.fr>
* Support `global-job` and `replicated-job` modes in Docker Swarm (#3016)Leonard Kinday2022-08-111-4/+4
| | | | | | | Add `global-job` and `replicated-job` modes Fixes #2829. Signed-off-by: Leonard Kinday <leonard@kinday.ru>
* docs: remove duplicate 'on' in comment (#2370)Thomas Gassmann2022-07-301-1/+1
| | | | | Remove duplicate 'on' in comment Signed-off-by: Thomas Gassmann <thomas.gassmann@hotmail.com>
* docs: image build clarifications/grammar (#2489)Max Fan2022-07-291-5/+5
| | | | | I changed was build > was built and reorganized a few sentences to be more clear. Signed-off-by: InnovativeInventor <theinnovativeinventor@gmail.com>
* docs: fix list formattingMilas Bowman2022-07-291-0/+1
| | | | Signed-off-by: Milas Bowman <milas.bowman@docker.com>
* Merge remote-tracking branch 'upstream/main' into HEADMilas Bowman2022-07-299-44/+109
|\
| * model: add remove() to Image (#3026)Milas Bowman2022-07-291-0/+18
| | | | | | | | | | | | | | | | Allow an Image to be deleted by calling the remove() method on it, just like a Volume. Signed-off-by: Ahmon Dancy <dancy@dancysoft.com> Signed-off-by: Milas Bowman <milas.bowman@docker.com> Co-authored-by: Ahmon Dancy <dancy@dancysoft.com>
| * api: add rollback_config to service create (#2917)ercildoune2022-07-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | `rollback_config` was not in the list of `CREATE_SERVICE_KWARGS` which prevented it from being an argument when creating services. It has now been added and the problem fixed, allowing services to have a rollback_config during creation and updating. Fixes #2832. Signed-off-by: Fraser Patten <pattenf00@gmail.com> Signed-off-by: Milas Bowman <milas.bowman@docker.com> Co-authored-by: Milas Bowman <milas.bowman@docker.com>
| * api: add force to plugin disable (#2843)Till!2022-07-291-2/+5
| | | | | | Signed-off-by: till <till@php.net>
| * api: add cgroupns option to container create (#2930)David2022-07-291-0/+6
| | | | | | Signed-off-by: David Otto <ottodavid@gmx.net>
| * api: add platform to container create (#2927)Felix Fontein2022-07-291-1/+2
| | | | | | | | | | | | | | 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>
| * client: use 12 character short IDs (#2862)Ben Fasoli2022-07-292-7/+7
| | | | | | | | | | | | Use 12 characters for Docker resource IDs for consistency with the Docker CLI. Signed-off-by: Ben Fasoli <benfasoli@gmail.com>
| * lint: fix outstanding flake8 violationsMilas Bowman2022-07-263-3/+11
| | | | | | | | | | | | | | Since flake8 wasn't actually being run in CI, we'd accumulated some violations. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
| * Merge pull request #2809 from feliperuhland/add-service-capabilityAnca Iordache2021-10-081-0/+6
| |\ | | | | | | Add service capability
| | * Add `CapabilityAdd` and `CapabilityDrop` toFelipe Ruhland2021-04-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ContainerSpec Docker Engine v1.41 added `CapAdd` and `CapDrop` as part of the ContainerSpec, and `docker-py` should do the same. ``` GET /services now returns CapAdd and CapDrop as part of the ContainerSpec. GET /services/{id} now returns CapAdd and CapDrop as part of the ContainerSpec. POST /services/create now accepts CapAdd and CapDrop as part of the ContainerSpec. POST /services/{id}/update now accepts CapAdd and CapDrop as part of the ContainerSpec. GET /tasks now returns CapAdd and CapDrop as part of the ContainerSpec. GET /tasks/{id} now returns CapAdd and CapDrop as part of the ContainerSpec. ``` I added capabilities on docstrings, `service.create` init method and create tests for that. That change was mention in issue #2802. Signed-off-by: Felipe Ruhland <felipe.ruhland@gmail.com>
| * | Improve containers documentationsinarostami2021-08-161-0/+8
| | | | | | | | | | | | Signed-off-by: sinarostami <Sinarostami4188.1@gmail.com>
| * | use python3.6+ constructsAnthony Sottile2021-07-056-19/+15
| | | | | | | | | | | | Signed-off-by: Anthony Sottile <asottile@umich.edu>
| * | [DOCS] Update the Image.save documentation with a working example. Issue #836Roger Camargo2021-06-031-2/+2
| |/ | | | | | | Signed-off-by: Roger Camargo <huogerac@gmail.com>
| * Fix `KeyError` when creating a new secretFelipe Ruhland2021-03-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | How to reproduce the issue: ```py >>> import docker >>> cli = docker.from_env() >>> cli.secrets.create(name="any_name", data="1") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/docker-py/docker/models/secrets.py", line 10, in __repr__ return "<%s: '%s'>" % (self.__class__.__name__, self.name) File "/home/docker-py/docker/models/secrets.py", line 14, in name return self.attrs['Spec']['Name'] KeyError: 'Spec' ``` The exception raises because create secrets API `/secrets/create` only return the `id` attribute: https://docs.docker.com/engine/api/v1.41/#operation/SecretCreate The secret model is created using just the `id` attribute and fails when looking for Spec.Name attribute. ```py def __repr__(self): return "<%s: '%s'>" % (self.__class__.__name__, self.name) ``` ```py @property def name(self): return self.attrs['Spec']['Name'] ``` I came up with a ugly solution but will prevent the problem to happen again: ```py def create(self, **kwargs): obj = self.client.api.create_secret(**kwargs) + obj.setdefault("Spec", {})["Name"] = kwargs.get("name") return self.prepare_model(obj) ``` After the API call, I added the name attribute to the right place to be used on the property name. ```py >>> import docker >>> cli = docker.from_env() >>> cli.secrets.create(name="any_name", data="1") <Secret: 'any_name'> ``` It isn't the most elegant solution, but it will do the trick. I had a previous PR #2517 when I propose using the `id` attribute instead of `name` on the `__repr__` method, but I think this one will be better. That fixes #2025 Signed-off-by: Felipe Ruhland <felipe.ruhland@gmail.com>
| * Support for docker.types.Placement.MaxReplicas (new in API 1.40) in Docker ↵Piotr Wojciechowski2020-12-251-0/+3
| | | | | | | | | | | | Swarm Service Signed-off-by: WojciechowskiPiotr <devel@it-playground.pl>
| * Fix docs typoaiordache2020-11-181-1/+1
| | | | | | | | Signed-off-by: aiordache <anca.iordache@docker.com>
| * Correct comments on ports_binding and host mode as network_modeDaeseok Youn2020-11-171-5/+2
| | | | | | | | Signed-off-by: Daeseok Youn <daeseok.youn@navercorp.com>
| * raise an error for binding specific ports in 'host' mode of networkDaeseok Youn2020-11-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | The binding ports are ignored where the network mode is 'host'. It could be a problem in case of using these options together on Mac or Windows OS. Because the limitation that could not use the 'host' in network_mode on Mac and Windows. When 'host' mode is set on network_mode, the specific ports in 'ports' are ignored so the network is not able to be accessed through defined ports by developer. Signed-off-by: Daeseok Youn <daeseok.youn@navercorp.com>
| * Merge pull request #2687 from IamTheFij/fix-model-plugin-upgrade-reloadAnca Iordache2020-10-161-1/+1
| |\ | | | | | | Fix plugin model upgrade
| | * Fix plugin model upgradeIan Fijolek2020-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When upgrading a plugin via the model interface, it would yield the following error: AttributeError: 'Plugin' object has no attribute '_reload' It appears that the proper method is `self.reload()`. This is what is used by all other methods in the class and base. I'm not finding any references to `_reload` apart from this instance in the project either. I've verified that this patch fixes the issue on my machine and all tests pass. Signed-off-by: Ian Fijolek <ian@iamthefij.com>
| * | update `pull` method docsaiordache2020-09-211-1/+2
| | | | | | | | | | | | Signed-off-by: aiordache <anca.iordache@docker.com>
| * | Set image default tag on pullaiordache2020-09-161-10/+11
| |/ | | | | | | Signed-off-by: aiordache <anca.iordache@docker.com>
| * Merge pull request #2520 from Nicceboy/masterAnca Iordache2020-08-071-2/+6
| |\ | | | | | | Disable compression by default when using container:get_archive method
| | * Disable compression by default when using get_archive methodNiklas Saari2020-02-261-2/+6
| | | | | | | | | | | | Signed-off-by: Niklas Saari <niklas.saari@tutanota.com>
| * | Add device requests (#2471)Lucidiot2020-08-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add DeviceRequest type Signed-off-by: Erwan Rouchet <rouchet@teklia.com> * Add device_requests kwarg in host config Signed-off-by: Erwan Rouchet <rouchet@teklia.com> * Add unit test for device requests Signed-off-by: Erwan Rouchet <rouchet@teklia.com> * Fix unit test Signed-off-by: Erwan Rouchet <rouchet@teklia.com> * Use parentheses for multiline import Signed-off-by: Erwan Rouchet <rouchet@teklia.com> * Create 1.40 client for device-requests test Signed-off-by: Laurie O <laurie_opperman@hotmail.com> Co-authored-by: Laurie O <laurie_opperman@hotmail.com> Co-authored-by: Bastien Abadie <abadie@teklia.com>
| * | Add support for DriverOpts in EndpointConfigMike Haboustak2020-04-301-0/+2
| |/ | | | | | | | | | | | | Docker API 1.32 added support for providing options to a network driver via EndpointConfig when connecting a container to a network. Signed-off-by: Mike Haboustak <haboustak@gmail.com>
* | Add healthcheck doc for container.runJanosch Deurer2020-06-151-1/+21
|/ | | | Signed-off-by: Janosch Deurer <deurer@mps-med.de>
* Merge pull request #2333 from hannseman/network-attachment-configJoffrey F2019-08-271-5/+7
|\ | | | | Add NetworkAttachmentConfig for service create/update
| * Correctly reference SecretReferenceHannes Ljungberg2019-05-031-1/+1
| | | | | | | | Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
| * Correctly reference ConfigReferenceHannes Ljungberg2019-05-031-2/+3
| | | | | | | | Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
| * Add NetworkAttachmentConfig typeHannes Ljungberg2019-05-031-2/+3
| | | | | | | | Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
* | Merge pull request #2352 from funkyfuture/container_list_docsJoffrey F2019-08-273-3/+6
|\ \ | | | | | | Amends the docs concerning multiple label filters
| * | Amends the docs concerning multiple label filtersFrank Sachsenheim2019-05-273-3/+6
| |/ | | | | | | | | | | Closes #2338 Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
* | Add documentation to argument 'mem_reservation'.Francis Laniel2019-07-161-1/+1
|/ | | | | | | | | | | | | | The documentation was added for function ContainerCollection::run and ContainerApiMixin::create_host_config. Signed-off-by: Francis Laniel <francis.laniel@lip6.fr> Add documentation to argument 'mem_reservation'. The documentation was added for function ContainerCollection::run and ContainerApiMixin::create_host_config. Signed-off-by: Francis Laniel <francis.laniel@lip6.fr>
* Add support for rotate_manager_unlock_keyHannes Ljungberg2019-05-011-3/+5
| | | | Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
* Merge pull request #2296 from hannseman/swarm-init-responseJoffrey F2019-05-011-3/+3
|\ | | | | Return node id on swarm init