zoukankan      html  css  js  c++  java
  • Docker 镜像添加模块

    Docker 镜像添加模块

     

    1. 使用root用户进入一个新容器,不要用 --rm .否则退出容器的时候,容器没有了

    docker run --user 0 -it --name superman testdockerfilebox/test_cpu:latest bash
    

    2. 在容器中添加你要的功能,然后退出容器

    apt install ...
    npm install -g n 
    pip3 install ...
    

    3. commit 刚才操作的容器成 image (testdockerfilebox/test_cpu:v1 名称和版本号可以自己定义)

    docker commit superman testdockerfilebox/test_cpu:v1
    

    4. 查看刚才 commit 操作的 image, 此时 image 里面就包含了刚才添加的新增的模块了

    root@test:~# docker images 
    
    REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE
    
    testdockerfilebox/test_cpu           v1                  e4f2c829d1eb        23 minutes ago      4.42GB
    

    5. 将新的 image 保存成 tar 压缩文件,给其他人使用,统一开发环境

    docker save testdockerfilebox/test_cpu:v1 -o test_cpu.tar
    

    6. 别人拿到 test_cpu.tar 文件后使用 docker load 加载 image

    docker load -i test_cpu.tar
    

    此时使用 docker images 就可以看到刚才的导入的 image 了

    root@test:~# docker images 
    
    REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE
    
    testdockerfilebox/test_cpu          v1                  e4f2c829d1eb        23 minutes ago      4.42GB
    

     

    改行去放羊
  • 相关阅读:
    PHP trim() 函数
    php 计算2个日期的相差天数
    php date('Y-n-j')的和date('Y-m-d')的区别
    转移服务器
    Invalid argument supplied for foreach()解决办法
    wordpress 后台忘记密码怎么办
    qrcode js插件生成微信二维码
    thinkphp5 注释
    tp5 新增完数据,获取id
    resstFul服务文件上传下载
  • 原文地址:https://www.cnblogs.com/musen/p/12092726.html
Copyright © 2011-2022 走看看