Visitar URL original
[FEATURE REQUEST] docker export to tar.gz · Issue #6916 · docker/cli · GitHub
Skip to content

[FEATURE REQUEST] docker export to tar.gz #6916

Description

@D3vil0p3r

Description

Currently docker export command allows to export a container as .tar.

I use docker mainly for creating WSL images (Linux distros) for Microsoft Store and the process needs to work with a .tar.gz archive that is converted in an Appx package.

Windows has not gzip included by default but only tar command.

To prevent the usage of gzip, there is no way to use only tar command to convert to gzip. It is not possible to first unarchive the tar archive and then compress them to tar.gz by tar command because the containers, if Linux based, have errors due to the structure of a Linux filesystem (that is inside the container).

To prevent this and also to separately install gzip, can you please implement a possibility to also export a container as .tar.gz? It can also allow us to export containers in a compressed and less space-consuming archive.

Activity

  1. vvoland commented on Apr 17, 2026

    @vvoland
    Collaborator

    On moby side, it should be just a matter of plumbing the compression type in: https://github.com/moby/moby/blob/88e3f1c86461a796a9164d4c7dde72e77339eae4/daemon/export.go#L69

    Not sure if we want to further extend the export operation though.

    Is there a reason you can't use Buildkit (docker build) to build and output the rootfs instead?

  2. D3vil0p3r commented on Apr 17, 2026

    @D3vil0p3r
    Author

    docker export would be the quickest solution. I automated all the process. In my CI/CD, it periodically update the Linux distro container to docker hub weekly, in order to keep packages updated. Then, by docker create and docker export I can directly archive the latest image online.

    If I should use docker build only for this purpose, it would be an additional command in the entire process, and it also takes time because of local building.

    If docker export could have the mentioned feature, it would save time because I prevent local building and I dont need to do two separated compressions (1st to tar and then to tar.gz, considering also the installation of needed third party tools).

  3. vvoland commented on Apr 17, 2026

    @vvoland
    Collaborator

    Is it just create + export directly without any steps in between? How do you build the image you run in the first place?

    If the image is built with docker build in the first place, you can just export a rootfs directy like:

    docker build . -o rootfs

    Or if you want to export an existing image you have, you could for example:

    echo 'FROM alpine' | docker build - -o alpine-rootfs
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions