docker 打包应用程序

docker 打包应用程序:
1,针对经常更换的环境问题部署的一套系统
2,部署web项目(python程序)是为了项目测试使用
首先配置 centso 环境
    docker pull centos
    # 指定 <image id> 启动 --net=host 可以和宿主机通信
    docker run --net=host -ti 9aec5c5fe4ba /bin/bash

    #启动网络连接 得到一个软件包 net-tools.x86_64
    yum search ifconfig
    # 安装软件 net-tools.x86_64
    # 可以使用 ifconfig 查看网络
    yum install net-tools.x86_64

    # 安装 python3.5(其他的可以视情况而定,和sentos安装相同)
    wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgz
    cd /usr/local/Python-3.5.3
    ./configure
    make
    make install
文件上传的 容器之中
    # 使用Ctrl+P+Q (退出但不停止容器)(也可以新开一个终端)
    # 主机文件 copy到 容器之中 <containerId>
    docker cp /home/hadoop/cpu-test b991647704dc:/home/
镜像打包与load
    #使用 Ctrl+P+Q (退出但不停止容器)
    # docker commit  <image id> <name/version>
    docker commit 4edc2d20ae7d cpu_collect
    # 将 镜像打包到本地 
    docker save -o ./cpu_collect.tar 40c8d763e0fc
    # 镜像加载(此时的REPOSITORY TAG 为空)
    docker load -i ./cpu_collect.tar
    # 为镜像重新命名(REPOSITORY 为 python-intel ,tar 为 latest)
    docker tag 40c8d763e0fc cpu_collect

 

转载于:https://www.cnblogs.com/shi-qi/articles/10701314.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值