上传镜像文件到服务器,通过把docker镜像保存为文件载入到别的服务器
在我們的工作環(huán)境中,一般鏡像通過上傳到鏡像倉庫中(本地或者公共倉庫),用到時下載到服務(wù)器上即可。如果服務(wù)器不能上網(wǎng),又沒有私有倉庫,我們就需要將鏡像保存為文件上傳到服務(wù)器上,載入鏡像即可使用。
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, --quiet? ? ? ? ? Suppress the load output
例:把剛才我們保存的文件上傳到我們需要的服務(wù)器上
docker load -i??centos.tar
或者:
docker load
docker images#查看到我們剛載入的鏡像
總結(jié)
以上是生活随笔為你收集整理的上传镜像文件到服务器,通过把docker镜像保存为文件载入到别的服务器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: nodejs ajax进度条,Ajax异
- 下一篇: SQL 新加字段查询窗口报错