Docker image push over SSH (distributed)

前端 未结 3 1406
礼貌的吻别
礼貌的吻别 2021-01-30 09:17

TL;DR Basically, I am looking for this:

docker push myimage ssh://myvps01.vpsprovider.net/

I am failing to grasp the rationale

3条回答
  •  再見小時候
    2021-01-30 09:51

    If you want to push docker images to a given host, there is already everything in Docker to allow this. The following example shows how to push a docker image through ssh:

    docker save  | ssh -C user@my.remote.host.com docker load
    
    • docker save will produce a tar archive of one of your docker images (including its layers)
    • -C is for ssh to compress the data stream
    • docker load creates a docker image from a tar archive

    Note that the combination of a docker registry + docker pull command has the advantage of only downloading missing layers. So if you frequently update a docker image (adding new layers, or modifying a few last layers) then the docker pull command would generate less network traffic than pushing complete docker images through ssh.

提交回复
热议问题