1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 上传镜像文件到服务器 通过把docker镜像保存为文件载入到别的服务器

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

时间:2023-08-19 06:23:21

相关推荐

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

在我们的工作环境中,一般镜像通过上传到镜像仓库中(本地或者公共仓库),用到时下载到服务器上即可。如果服务器不能上网,又没有私有仓库,我们就需要将镜像保存为文件上传到服务器上,载入镜像即可使用。

1、保存镜像为文件

命令:

#docker save --help

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

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

Options:

-o, --output string Write to a file, instead of STDOUT

例:

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

centos latest 0f3e07c0138f 2 months ago 220MB

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

2、文件载入镜像

命令:

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, --quietSuppress the load output

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

docker load -icentos.tar

或者:

docker load

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

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。