Sit*_*kan 6 docker docker-compose
我有.tar docker映像文件的列表,我尝试使用以下命令加载docker映像
docker load -i *.tardocker load -i alldockerimages.tar其中alldockerimages.tar包含所有单独的tar文件。
让我知道如何加载多个tar文件。
Chr*_*ski 10
使用 xargs:
ls -1 *.tar | xargs --no-run-if-empty -L 1 docker load -i
(先前的修订版将 -i 标志保留为“docker load”。)
首先,我尝试使用您首先描述的全局表达式方法:
# download some images to play with
docker pull alpine
docker pull nginx:alpine
# stream the images to disk as tarballs
docker save alpine > alpine.tar
docker save nginx:alpine > nginx.tar
# delete the images so we can attempt to load them from scratch
docker rmi alpine nginx:alpine
# issue the load command to try and load all images at once
cat *.tar | docker load
Run Code Online (Sandbox Code Playgroud)
不幸的是,这仅导致alpine.tar被加载。我的理解(可能是错误的)是,将对glob表达式进行扩展,并最终使该docker load命令针对该glob表达式所扩展到的每个文件运行。
因此,必须使用shell for循环依次加载所有tarball:
for f in *.tar; do
cat $f | docker load
done
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
986 次 |
| 最近记录: |