Commit Graph

3172 Commits

Author SHA1 Message Date
Steve Swor 37e930f4d0 Add optional parameters for pruning build cache.
Signed-off-by: Steve Swor <sworisbreathing@users.noreply.github.com>
2021-04-06 11:23:54 -03:00
Anca Iordache 18fdc23b7c
Merge pull request #2476 from feliperuhland/add-search-images-limit
Add limit parameter to image search endpoint
2021-04-06 14:43:07 +01:00
Anca Iordache 8813c3d2e0
Merge pull request #2799 from feliperuhland/fix-low-level-pull-example
Fix images low-level documentation examples
2021-04-06 14:41:44 +01:00
Anca Iordache 7a2ec95951
Merge pull request #2801 from feliperuhland/fix-low-level-containers-example
Fix containers low-level documentation examples
2021-04-06 14:40:39 +01:00
Felipe Ruhland ac9ae1f249 Fix containers low-level documentation examples
I realize that low-level documentation has outdated examples, so I
created issue #2800 to fix that

Signed-off-by: Felipe Ruhland <felipe.ruhland@gmail.com>
2021-04-05 15:31:43 +02:00
Felipe Ruhland a34dd8b1a9 Fix images low-level documentation examples
I realize that the documentation of low-level `images` was outdated when
answering issue #2798

The issue can reproduce it with a simple test:

```py
In [1]: import docker
In [2]: client = docker.from_env()
In [3]: client.pull
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-d0931943ca5d> in <module>
----> 1 client.pull

~/docker-py/docker/client.py in __getattr__(self, name)
    219                      "object APIClient. See the low-level API section of the "
    220                      "documentation for more details.")
--> 221         raise AttributeError(' '.join(s))
    222
    223

AttributeError: 'DockerClient' object has no attribute 'pull' In Docker SDK for Python 2.0, this method is now on the object APIClient. See the low-level API section of the documentation for more details.

In [4]: client.push
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-f7d5b860a184> in <module>
----> 1 client.push

~/docker-py/docker/client.py in __getattr__(self, name)
    219                      "object APIClient. See the low-level API section of the "
    220                      "documentation for more details.")
--> 221         raise AttributeError(' '.join(s))
    222
    223

AttributeError: 'DockerClient' object has no attribute 'push' In Docker SDK for Python 2.0, this method is now on the object APIClient. See the low-level API section of the documentation for more details.

In [5]: client.tag
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-043bdfd088ca> in <module>
----> 1 client.tag

~/docker-py/docker/client.py in __getattr__(self, name)
    219                      "object APIClient. See the low-level API section of the "
    220                      "documentation for more details.")
--> 221         raise AttributeError(' '.join(s))
    222
    223

AttributeError: 'DockerClient' object has no attribute 'tag' In Docker SDK for Python 2.0, this method is now on the object APIClient. See the low-level API section of the documentation for more details.

In [6]: client.get_image
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-477c12713276> in <module>
----> 1 client.get_image

~/docker-py/docker/client.py in __getattr__(self, name)
    219                      "object APIClient. See the low-level API section of the "
    220                      "documentation for more details.")
--> 221         raise AttributeError(' '.join(s))
    222
    223

AttributeError: 'DockerClient' object has no attribute 'get_image' In Docker SDK for Python 2.0, this method is now on the object APIClient. See the low-level API section of the documentation for more details.

In [7]: client.api.get_image
Out[7]: <bound method ImageApiMixin.get_image of <docker.api.client.APIClient object at 0x7fad6a2037c0>>

In [8]: client.api.tag
Out[8]: <bound method ImageApiMixin.tag of <docker.api.client.APIClient object at 0x7fad6a2037c0>>

In [9]: client.api.pull
Out[9]: <bound method ImageApiMixin.pull of <docker.api.client.APIClient object at 0x7fad6a2037c0>>

In [10]: client.api.push
Out[10]: <bound method ImageApiMixin.push of <docker.api.client.APIClient object at 0x7fad6a2037c0>>
```

Signed-off-by: Felipe Ruhland <felipe.ruhland@gmail.com>
2021-04-05 15:01:09 +02:00
Ulysses Souza 0892fcfc12
Merge pull request #2795 from feliperuhland/upgrade-cryptography-to-3.4.7
Upgrade cryptography library to version 3.4.7
2021-04-03 14:48:58 -03:00
Felipe Ruhland 2403774e76 Upgrade cryptography library to version 3.4.7
Dependabot opened a pull request
93bcc0497d to upgrade cryptography from
2.3 to 3.2.

However, only `requirements.txt` was updated.
The extra requirements were kept outdated.

This commit was made to update the library to the last version.

Fix #2791

Signed-off-by: Felipe Ruhland <felipe.ruhland@gmail.com>
2021-04-02 02:51:20 +02:00
Ulysses Souza a60bd9a454
Merge pull request #2781 from feliperuhland/fix-readme-badge
Fix continuous integration status badged
2021-03-29 22:06:31 +02:00
Anca Iordache 30d482d359
Merge pull request #2788 from docker/set-minimal-python-to-3_6
Make python 3.6 the minimum version
2021-03-25 09:59:41 +01:00
Anca Iordache d2aa221638
Merge pull request #2793 from feliperuhland/create-secret-missing-name
Fix `KeyError` when creating a new secret
2021-03-25 09:58:02 +01:00
Felipe Ruhland d4310b2db0 Fix `KeyError` when creating a new secret
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>
2021-03-24 18:03:54 +01:00
Ulysses Souza c8fba210a2 Remove support to pre python 3.6
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-03-22 10:18:23 -03:00
Anca Iordache 31775a1532
Merge pull request #2782 from hakanardo/verify_tls
Verify TLS keys loaded from docker contexts
2021-03-10 16:17:34 +01:00
Nicolas De Loof 563124163a relax PORT_SPEC regex so it accept and ignore square brackets
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-03-10 11:25:18 +01:00
Hakan Ardo c239d66d5d Verify TLS keys loaded from docker contexts
This maches the behaviour of the docker cli when using contexts.

Signed-off-by: Hakan Ardo <hakan@debian.org>
2021-03-03 09:30:19 +01:00
Felipe Ruhland d836bb8703 Fix continuous integration status badged
https://docs.github.com/en/actions/managing-workflow-runs/
adding-a-workflow-status-badge

Signed-off-by: Felipe Ruhland <felipe.ruhland@gmail.com>
2021-02-26 22:02:55 +01:00
Ulysses Souza 55f405e04a
Merge pull request #2780 from aiordache/changelog_4.4.4
Update changelog for 4.4.4
2021-02-25 10:30:18 -03:00
Felipe Ruhland 7d316641a3 Add limit parameter to image search endpoint
Signed-off-by: Felipe Ruhland <felipe.ruhland@gmail.com>
2021-02-24 23:42:20 +01:00
aiordache 148f9161e1 Update changelog for 4.4.4
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-02-24 18:20:24 +01:00
Anca Iordache d09fe8d225
Merge pull request #2778 from aiordache/openssl_mismatch_bug
Drop LD_LIBRARY_PATH env var for SSH shellout
2021-02-24 16:39:55 +01:00
Anca Iordache 69087ab977
Merge pull request #2772 from aiordache/update_changelog_4.4.3
Update changelog post-release 4.4.3
2021-02-24 14:32:02 +01:00
aiordache 43ca2f8ff9 Drop LD_LIBRARY_PATH env var for SSH shellout
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-02-23 19:04:03 +01:00
aiordache fe995ae79f Update changelog post-release 4.4.3
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-02-19 17:33:16 +01:00
aiordache e6689e0bb9 Post-release 4.4.2 changelog updates
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-02-18 11:19:11 -03:00
aiordache 2807fde6c9 Fix SSH port parsing and add regression tests
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-02-18 10:56:29 -03:00
Anca Iordache d065daf522
Merge pull request #2711 from vlad-ro/fix-doc-formatting
Fix doc formatting
2021-02-12 16:38:20 +01:00
Anca Iordache c15ee3925d
Merge pull request #2764 from StefanScherer/clean-home-docker
Use DOCKER_CONFIG to have creds in dind environment
2021-02-11 20:31:13 +01:00
aiordache 00da4dc0ea Run unit tests in a container with no .docker/config mount
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-02-11 19:58:35 +01:00
Stefan Scherer 6de6936f5d
Use DOCKER_CONFIG to have creds in dind environment
Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
2021-02-11 18:40:37 +01:00
Anca Iordache 407dcfd65b
Merge pull request #2763 from StefanScherer/revert-to-wrappedNode
Revert back to wrappedNode
2021-02-11 17:16:49 +01:00
Stefan Scherer 94d7983ef0
Revert back to wrappedNode
Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
2021-02-11 10:24:57 +01:00
Vlad Romanenko 56d4b09700 Fix doc formatting
Signed-off-by: Vlad Romanenko <vlad.romanenko@hotmail.com>
2021-02-10 21:27:15 +02:00
Anca Iordache b3aa239432
Merge pull request #2761 from StefanScherer/no-wrappedNode
Remove wrappedNode
2021-02-10 17:18:12 +01:00
Stefan Scherer 9556b890f9
Remove wrappedNode
Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
2021-02-10 16:57:30 +01:00
Anca Iordache caef663729
Merge pull request #2741 from WojciechowskiPiotr/maxreplicas
Support for docker.types.Placement.MaxReplicas
2021-02-10 14:54:55 +01:00
aiordache ccab78840e Bump cffi to 1.14.4
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-02-10 10:35:55 -03:00
aiordache f520b4c4eb Update GH action step
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-02-10 10:35:55 -03:00
WojciechowskiPiotr 6d1dffe3e5 Unit and integration tests added
Signed-off-by: WojciechowskiPiotr <devel@it-playground.pl>
2021-02-09 21:37:26 +01:00
Anca Iordache a653052276
Merge pull request #2759 from StefanScherer/ubuntu-2004
Update CI to ubuntu-2004
2021-02-09 20:54:21 +01:00
Stefan Scherer 9e007469ef
Update CI to ubuntu-2004
Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
2021-02-09 20:39:54 +01:00
Christian Clauss da32a2f1a2 GitHub Actions: Upgrade actions/checkout
https://github.com/actions/checkout/releases
Signed-off-by: Christian Clauss <cclauss@me.com>
2021-02-09 16:10:42 -03:00
WojciechowskiPiotr 514f98a0d6 Support for docker.types.Placement.MaxReplicas (new in API 1.40) in Docker Swarm Service
Signed-off-by: WojciechowskiPiotr <devel@it-playground.pl>
2021-02-09 19:45:52 +01:00
Anca Iordache d7b16ef0fb
Merge pull request #2755 from aiordache/fix_ssh_bug
Fix host trimming and remove quiet flag for the ssh connection
2021-02-09 18:26:44 +01:00
Anca Iordache 78f5249ed0
Merge pull request #2739 from cclauss/setup.py-py38-py39
setup.py: Add support for Python 3.8 and 3.9
2021-02-09 18:21:55 +01:00
Anca Iordache 8615a61bd1
Merge pull request #2743 from cclauss/patch-2
print() is a function in Python 3
2021-02-09 15:18:12 +01:00
aiordache caab390696 Fix host trimming and remove quiet flag for the ssh connection
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-02-09 10:17:00 +01:00
Anca Iordache f0517f842b
Merge pull request #2754 from aiordache/update_Jenkins_setup
Set the base image to `dockerpinata/docker-py` in Jenkinsfile
2021-02-08 20:35:58 +01:00
aiordache 0edea80c41 Update base image to `dockerpinata/docker-py` in Jenkinsfile
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-02-08 20:04:14 +01:00
Christian Clauss 10ff403079 print() is a function in Python 3
Like #2740 but for the docs

Signed-off-by: Christian Clauss <cclauss@me.com>
2020-12-28 19:14:55 +01:00