docker image save

說明將一或多個映像檔儲存到 tar 封存檔(預設會串流到 STDOUT)
用法docker image save [選項] 映像檔 [映像檔...]
別名
docker save

說明

產生一個 tar 格式的儲存庫到標準輸出串流。包含所有父層,以及所有標籤 + 版本,或指定的 repo:tag,適用於提供的每個參數。

選項

選項預設值說明
-o, --output寫入到檔案,而不是 STDOUT

範例

建立一個備份,然後可以用 docker load 使用。

$ docker save busybox > busybox.tar

$ ls -sh busybox.tar

2.7M busybox.tar

$ docker save --output busybox.tar busybox

$ ls -sh busybox.tar

2.7M busybox.tar

$ docker save -o fedora-all.tar fedora

$ docker save -o fedora-latest.tar fedora:latest

使用 gzip 將映像檔儲存到 tar.gz 檔案

您可以使用 gzip 來儲存映像檔並縮小備份大小。

$ docker save myimage:latest | gzip > myimage_latest.tar.gz

挑選特定標籤

您甚至可以挑選映像檔儲存庫的特定標籤。

$ docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy