经过把docker镜像保存为文件载入到别的服务器

       在咱们的工做环境中,通常镜像经过上传到镜像仓库中(本地或者公共仓库),用到时下载到服务器上便可。若是服务器不能上网,又没有私有仓库,咱们就须要将镜像保存为文件上传到服务器上,载入镜像便可使用。docker

    一、保存镜像为文件
centos

    命令:
服务器

#docker save --helpide

Usage:  docker save [OPTIONS] IMAGE [IMAGE...]
ui

Save one or more images to a tar archive (streamed to STDOUT by default)
spa

Options:
input

  -o, --output string   Write to a file, instead of STDOUT文件上传

例:string

docker images|grep centos#查看须要保存的镜像it

centos                                           latest              0f3e07c0138f        2 months ago        220MB

docker save -o centos.tar centos#把镜像保存为centos.tar文件,ls能够查看到该文件。

    二、文件载入镜像

    命令:

docker load --help

Usage:  docker load [OPTIONS]

Load an image from a tar archive or STDIN

Options:

  -i, --input string   Read from tar archive file, instead of STDIN

  -q, --quiet          Suppress the load output

例:把刚才咱们保存的文件上传到咱们须要的服务器上

docker load -i  centos.tar 

或者:

docker load <centos.tar

docker images#查看到咱们刚载入的镜像

相关文章
相关标签/搜索