美文网首页
docker镜像的导入导出和拉取

docker镜像的导入导出和拉取

作者: 小蜗牛爬楼梯 | 来源:发表于2020-07-10 15:58 被阅读0次

    场景:在搭建HyperLedger Fabric1.4的基础环境时,会频繁的和docker镜像打交道,公司内网一般都不给力,所以更多的情况是从别的虚拟机上将docker镜像导出,再通过U盘等方式导入在自己的虚拟机上。

    1.docker镜像的导出(使用docker images查看已有镜像,根据镜像的Image ID保存到本虚拟机的/tmp/docker-images文件夹,保存位置可以自己定)

    docker save 432c24764fbb> /tmp/docker-images/fabric-tools-1.4.1.tar
    docker save d7433c4b2a1c> /tmp/docker-images/fabric-ccenv-1.4.1.tar
    docker save ec4ca236d3d4> /tmp/docker-images/fabric-orderer-1.4.1.tar
    docker save a1e3874f338b> /tmp/docker-images/fabric-peer-1.4.1.tar
    docker save 3a1799cda5d7> /tmp/docker-images/fabric-ca-1.4.1.tar
    docker save 20c6045930c8> /tmp/docker-images/fabric-zookeeper-0.4.15.tar
    docker save b4ab82bbaf2f> /tmp/docker-images/fabric-kafka-0.4.15.tar
    docker save 8de128a55539> /tmp/docker-images/fabric-couchdb-0.4.15.tar
    docker save 9d6ec11c60ff> /tmp/docker-images/fabric-baseos-0.4.15.tar
    

    2.docker镜像的导入(通过U盘等设备将已经备份好的镜像tar包拷贝到不能联网或网络连接有问题的虚拟机上进行导入,存放目录同为/tmp/docker-images,也可更改目录)

    docker load < /tmp/docker-images/fabric-tools-1.4.1.tar
    docker load < /tmp/docker-images/fabric-ccenv-1.4.1.tar
    docker load < /tmp/docker-images/fabric-orderer-1.4.1.tar
    docker load < /tmp/docker-images/fabric-peer-1.4.1.tar
    docker load < /tmp/docker-images/fabric-ca-1.4.1.tar
    docker load < /tmp/docker-images/fabric-zookeeper-0.4.15.tar
    docker load < /tmp/docker-images/fabric-kafka-0.4.15.tar
    docker load < /tmp/docker-images/fabric-couchdb-0.4.15.tar
    docker load < /tmp/docker-images/fabric-baseos-0.4.15.tar
    

    3.导入后的镜像的TAG都为空,需要为镜像做TAG

    docker tag 432c24764fbb docker.io/hyperledger/fabric-tools:latest
    docker tag d7433c4b2a1c docker.io/hyperledger/fabric-ccenv:latest
    docker tag ec4ca236d3d4 docker.io/hyperledger/fabric-orderer:latest
    docker tag a1e3874f338b docker.io/hyperledger/fabric-peer:latest
    docker tag 3a1799cda5d7 docker.io/hyperledger/fabric-ca:latest
    docker tag 20c6045930c8 docker.io/hyperledger/fabric-zookeeper:latest
    docker tag b4ab82bbaf2f docker.io/hyperledger/fabric-kafka:latest
    docker tag 8de128a55539 docker.io/hyperledger/fabric-couchdb:latest
    docker tag 9d6ec11c60ff docker.io/hyperledger/fabric-baseos:latest
    

    4.镜像的拉取(在网络比较好的情况下,也可以直接使用docker命令从在线拉取镜像到本地)

    docker pull hyperledger/fabric-tools:amd64-1.4.1
    docker pull hyperledger/fabric-ccenv:amd64-1.4.1
    docker pull hyperledger/fabric-orderer:amd64-1.4.1
    docker pull hyperledger/fabric-peer:amd64-1.4.1
    docker pull hyperledger/fabric-ca:amd64-1.4.1
    docker pull hyperledger/fabric-kafka:amd64-0.4.15
    docker pull hyperledger/fabric-zookeeper:amd64-0.4.15
    docker pull hyperledger/fabric-couchdb:amd64-0.4.15
    

    相关文章

      网友评论

          本文标题:docker镜像的导入导出和拉取

          本文链接:https://www.haomeiwen.com/subject/laemcktx.html