美文网首页
docker - commit、publish、transmis

docker - commit、publish、transmis

作者: 好小葱1 | 来源:发表于2018-07-31 11:49 被阅读255次

    提交container定制镜像

    sudo docker commit -m '修改的信息' container_name image_name:tag
    

    上传镜像到仓库

    • 上传镜像->repository(!如果该repository不存在的话,会自动创建
    $ sudo docker images 
    REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
    mgm_db                      base                96244ef9009e        5 hours ago         544.3 MB
    ubuntu                      16.04               14f60031763d        2 weeks ago         119.5 MB
    
    # 打tag,注意格式:用户名/repository_name:TAG
    $ sudo docker tag 96 xiaochonghao/mgm_db:v0
    
    # push镜像到xiaochonghao用户的mgm_db仓库中,如果xiaochonghao/mgm_db在仓库中不存在,则执行这条命令他过程中会自动创建repository
    $ sudo docker push xiaochonghao/mgm_db:v0
    The push refers to a repository [docker.io/xiaochonghao/mgm_db]
    793707dbc2c3: Pushed 
    26b126eb8632: Mounted from library/ubuntu 
    220d34b5f6c9: Mounted from library/ubuntu 
    8a5132998025: Mounted from library/ubuntu 
    aca233ed29c3: Mounted from library/ubuntu 
    e5d2f035d7a4: Mounted from library/ubuntu 
    v1: digest: sha256:73f9e04a5ab4f5a823574e4fc4a4cfefc7fa573af22fd0122a8839905552b372 size: 1570
    

    不通过docker pub账号,在主机之间传输镜像

    • You will need to save the docker image as a tar file:

      # 这里的image name可以随便起名字
      docker save -o <save image to path> <image name>
      
    • copy image to new system with scp

      ex:
      scp /tmp/oss_web_image root@10.13.2.133:/tmp/
      
    • load the image into docker

      docker load -i <path to image tar file>
      

    相关文章

      网友评论

          本文标题:docker - commit、publish、transmis

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