zoukankan      html  css  js  c++  java
  • docker镜像管理基础操作

    docker image pull nginx:1.14-alpine
    docker image pull busybox
    docker pull quay.io/coreos/flannel:v0.10.0-amd64
    docker image pull redis:4-alpine
    docker run --name b1 -it busybox(操作完后别关闭)
    docker commit -p b1 (做镜像)
    docker tag 95249914d032 mageedu/httpd:v0.1-1(给镜像id95249914d032打标,冒号后面是标签)
    docker tag mageedu/httpd:v0.1-1 magedu/httpd:latest (再次做镜像)
    docker image rm magedu/httpd:latest
    docker commit -a '作者信息' -c "CMD ['/bin/httpd'(命令源which可查),'-f'(前台),'-h'(指定目录根),'/data/html'(目录)]" -p(暂停) b1 m/httpd:v1(改镜像启动后前台运行,注意引号)
    docker inspect (查看信息)
    推镜像
    docker login -u 网站用户名 (输入密码后提示Login Succeeded成功)
    docker push XXX/httpd(不加标签默认这个名字都推上去,XXX是网上的名字必须一致不然无法推)

    登录阿里云仓库
    https://cr.console.aliyun.com/repository/cn-shenzhen/le1543/httpd/details
    docker login --username=xxxx@163.com registry.cn-shenzhen.aliyuncs.com
    docker tag [ImageId] registry.cn-shenzhen.aliyuncs.com/le1543/httpd:[镜像版本号]
    docker push registry.cn-shenzhen.aliyuncs.com/le1543/httpd:[镜像版本号]

    过程
    docker login --username=xxxx.com registry.cn-shenzhen.aliyuncs.com(登录阿里云仓库)
    docker tag le1543/httpd:v2 registry.cn-shenzhen.aliyuncs.com/le1543/httpd:v2 (做镜像)
    docker push registry.cn-shenzhen.aliyuncs.com/le1543/httpd (可带版本)

    打包镜像
    docker save -o 打包名称 被打包文件1 被打包文件2 被打包文件3.......
    传送到其他主机
    scp myimages2.gz 192.168.3.22:/root/


    其他主机上解压

    docker load -i myimages2.gz
    docker images就能看到新入的两个备份镜像

    docker run --name 容器名 目标名称:版本 (已经封装前台测试)
    docker run --name t1 registry.cn-shenzhen.aliyuncs.com/le1543/httpd:v2
    查看t1容器ip
    docker inspect t1
    curl ip

  • 相关阅读:
    create-react-app 修改 webpack output.publicPath
    洛谷 P1282 多米诺骨牌 (01背包)
    UVa 1627
    UVa 1626
    UVa 11584
    UVa 11400
    UVa 116
    UVa 1347 Tour (dp)
    树形背包小结
    数据流图题目一
  • 原文地址:https://www.cnblogs.com/Leaders543/p/12102157.html
Copyright © 2011-2022 走看看