stratos@Dev-PC:~$ docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEcouchdb-cartridge latest 7ebc8510bc2c 17 hours ago 1.102 GB192.168.57.30:5042/couchdb-cartridge latest 7ebc8510bc2c 17 hours ago 1.102 GBubuntu 14.04 53bf7a53e890 3 days ago 221.3 MB
将存档名称图像保存到tar文件中。我将使用/media/sf_docker_vm/来保存图像。
stratos@Dev-PC:~$ docker save imageID > /media/sf_docker_vm/archiveName.tar
stratos@Dev-PC:~$ docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEcouchdb-cartridge latest 7ebc8510bc2c 17 hours ago 1.102 GB192.168.57.30:5042/couchdb-cartridge latest bc8510bc2c 17 hours ago 1.102 GBubuntu 14.04 4d2eab1c0b9a 3 days ago 221.3 MB
Error Pushing Image: Ensure localhost:5000 is added to your insecure registries.
More Details (OS X): https://stackoverflow.com/questions/32808215/where-to-set-the-insecure-registry-flag-on-mac-os
#!/bin/bash
#files will be saved in the dir 'Docker_images'
mkdir Docker_images
cd Docker_images
directory=`pwd`
c=0
#save the image names in 'list.txt'
doc= docker images | awk '{print $1}' > list.txt
printf "START \n"
input="$directory/list.txt"
#Check and create the image tar for the docker images
while IFS= read -r line
do
one=`echo $line | awk '{print $1}'`
two=`echo $line | awk '{print $1}' | cut -c 1-3`
if [ "$one" != "<none>" ]; then
c=$((c+1))
printf "\n $one \n $two \n"
docker save -o $two$c'.tar' $one
printf "Docker image number $c successfully converted: $two$c \n \n"
fi
done < "$input"
码头载重:
#!/bin/bash
cd Docker_images/
directory=`pwd`
ls | grep tar > files.txt
c=0
printf "START \n"
input="$directory/files.txt"
while IFS= read -r line
do
c=$((c+1))
printf "$c) $line \n"
docker load -i $line
printf "$c) Successfully created the Docker image $line \n \n"
done < "$input"