如何压缩最新的docker镜像?

我想压缩(最后通过rsync发送到其他服务器)我的最后一个备份Docker映像,以实现自动化。 我试试这个:

sudo docker save -o dockdebian.tar.gz | sudo docker images | awk 'NR==2{ print $3 }'

选择图像列表的第一个ID。 但是给了我这个错误:

  

“ docker save”至少需要1个参数。

     

请参阅“ docker save --help”。

     

用法:docker save [OPTIONS] IMAGE [IMAGE ...]

     

将一个或多个图像保存到tar存档中(默认情况下流式传输到STDOUT)

     

xxxxxxxxxxxx

haishizhende 回答:如何压缩最新的docker镜像?

您必须在shell中使用命令替换。此处更多信息:https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html

from django.shortcuts import render
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from botpaf.serializers import SpeechSerializer


@api_view(['POST','GET'])

def speech_list(request):
   if request.method == 'POST':
      serializer = SpeechSerializer(data=request.data)
      return Response(serializer.data,status=status.HTTP_200_OK)

docker save -o dockdebian.tar.gz $(sudo docker images | awk 'NR==2{ print $3 }')
本文链接:https://www.f2er.com/3137406.html

大家都在问