Skip to content

Low-level API container export #1774

@ThraaxSession

Description

@ThraaxSession

Hi together,

I've got an issue to export a container with the low level API:

docker version
Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:42:18 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:40:56 2017
 OS/Arch:      linux/amd64
 Experimental: false

The documentation says:

Parameters: | container (str) – The container to export -- | --The filesystem tar archive (str)
docker.errors.APIError – If the server returns an error.

But I don't get a string, instead I get a HTTPresponse object. But when I do object.text, .json(), .content it doesn't work.

This is my export function:

from docker import APIClient
...
self.cli = APIClient(base_url=self.base_url, timeout=self.timeout)
....
def archive(self):
        """Archive the container"""
        # Returns the path to the exported file
        try:
            return self.cli.export(container=self.container.get('Id'))
        except errors.APIError as ex:
            raise ex

If you need more information, let me know. :)

Gino

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions