...

Text file src/github.com/docker/cli/docs/reference/commandline/image_save.md

Documentation: github.com/docker/cli/docs/reference/commandline

     1# save
     2
     3<!---MARKER_GEN_START-->
     4Save one or more images to a tar archive (streamed to STDOUT by default)
     5
     6### Aliases
     7
     8`docker image save`, `docker save`
     9
    10### Options
    11
    12| Name             | Type     | Default | Description                        |
    13|:-----------------|:---------|:--------|:-----------------------------------|
    14| `-o`, `--output` | `string` |         | Write to a file, instead of STDOUT |
    15
    16
    17<!---MARKER_GEN_END-->
    18
    19## Description
    20
    21Produces a tarred repository to the standard output stream.
    22Contains all parent layers, and all tags + versions, or specified `repo:tag`, for
    23each argument provided.
    24
    25## Examples
    26
    27### Create a backup that can then be used with `docker load`.
    28
    29```console
    30$ docker save busybox > busybox.tar
    31
    32$ ls -sh busybox.tar
    33
    342.7M busybox.tar
    35
    36$ docker save --output busybox.tar busybox
    37
    38$ ls -sh busybox.tar
    39
    402.7M busybox.tar
    41
    42$ docker save -o fedora-all.tar fedora
    43
    44$ docker save -o fedora-latest.tar fedora:latest
    45```
    46
    47### Save an image to a tar.gz file using gzip
    48
    49You can use gzip to save the image file and make the backup smaller.
    50
    51```console
    52$ docker save myimage:latest | gzip > myimage_latest.tar.gz
    53```
    54
    55### Cherry-pick particular tags
    56
    57You can even cherry-pick particular tags of an image repository.
    58
    59```console
    60$ docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy
    61```

View as plain text