Moving docker-compose containersets around between hosts

后端 未结 1 735
鱼传尺愫
鱼传尺愫 2021-01-04 13:48

I would like to take my application stack, consisting of 3 docker images and managed by docker-compose, and move it in its entirety from my development machine onto a produc

相关标签:
1条回答
  • 2021-01-04 14:11

    There is no functionality in Compose to save the images built in a Compose file, it's the job of the docker client (as you stated with docker save and docker load). Fortunately it's straightforward with bash:

    images=(web cache db)
    for image in images
    do
        docker save ${image} > ${image}.tar
        scp ${image}.tar $yourhost:
        ssh $yourhost docker load ${image}.tar
    done
    

    The remote registry option is perhaps a more "production grade" approach. Moving a bunch of images around is likely to be pretty slow, but YMMV.

    0 讨论(0)
提交回复
热议问题