1. 程式人生 > >3-3.6 存出和載入映象

3-3.6 存出和載入映象

使用 docker save 和 docker load 命令存出和載入映象。

存出鏡像

    將映象存出到本地檔案,使用docker save 。例如將busybox:latest映象存出為檔案bbox_latest.tar檔案:

# docker images
REPOSITORY                                    TAG                 IMAGE ID            CREATED             SIZE
docker.io/busybox                             latest              22c2dd5ee85d        2 months ago        1.16 MB
# docker save -o bbox_latest.tar docker.io/busybox

載入映象

    將本地的映象檔案匯入到映象倉庫中,使用docker load。例如叫bbox_latest.tar檔案匯入到本地映象庫中,如下:

# docker load --input bbox_latest.tar

docker load < bbox_latest.tar

如此匯入映象及相關的元資料資訊,使用 docker images檢視。