Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def get(self, container, **kwargs):
data = await self.docker._query_json(
"containers/{container}/json".format(container=container),
method="GET",
params=kwargs,
)
return DockerContainer(self.docker, **data)
def container(self, container_id, **kwargs):
data = {"id": container_id}
data.update(kwargs)
return DockerContainer(self.docker, **data)
async def create(self, config, *, name=None):
url = "containers/create"
config = json.dumps(config, sort_keys=True).encode("utf-8")
kwargs = {}
if name:
kwargs["name"] = name
data = await self.docker._query_json(
url, method="POST", data=config, params=kwargs
)
return DockerContainer(self.docker, id=data["Id"])