I couldn't create secret object, the problem seemed to boil down to the way that a secret was being created from the docker daemon response.
|
def create(self, **kwargs): |
|
obj = self.client.api.create_secret(**kwargs) |
|
return self.prepare_model(obj) |
Docker version 18.03.1-ce and python version 3.5 had the following error:
File "docker/models/secrets.py", line 10 in __repr__
return "<%s: %s'>" % (self.__class__.__name__, self.name)
File "docker/models/secrets.py", line 14 in name
return self.attrs['Spec']['Name']
KeyError: 'Spec'
When calling:
import docker
client -docker.from_env()
mySecret = client.secrets.create(name='randomName', data='platform_node_requirements.md')
Changing the code to the following seemed to fix it.
obj = self.client.api.create_secret(**kwargs)
secret = self.client.secrets.get(obj.get('ID'))
return self.prepare_model(secret)
I couldn't create secret object, the problem seemed to boil down to the way that a secret was being created from the docker daemon response.
docker-py/docker/models/secrets.py
Lines 31 to 33 in 467cacb
Docker version 18.03.1-ce and python version 3.5 had the following error:
When calling:
Changing the code to the following seemed to fix it.