zoukankan      html  css  js  c++  java
  • 基于centos 创建一个stress镜像

    最近需要学习docker的Cgroups机制,需要用到stress进行测试,前期工作就是自己创建一个stress镜像。

    1. 新建一个 Dockerfile 文件
      [vagrant@localhost ~]$ mkdir -p /tmp/stress
      [vagrant@localhost stress]$ sudo vi Dockerfile
      FROM library/centos
      
      ADD epel-7.repo /etc/yum.repos.d/
      RUN yum clean all && yum makecache
      RUN yum install -y stress
      #CMD与ENTRYPOINT的区别在于执行docker run时参数传递的方式不同
      ENTRYPOINT ["stress", "--verbose"]

         

    2. 构建镜像
      [vagrant@localhost stress]$ docker build -t centos-stress:1.0.1 .
    3.  查看镜像是否生成
      [vagrant@localhost stress]$ docker images          
      REPOSITORY                                       TAG                 IMAGE ID            CREATED             SIZE
      centos-stress                                    1.0.1               3dd149b42c38        25 minutes ago      713MB

        

    4. 测试改镜像成功
      [vagrant@localhost cgroup]$ docker run -ti --rm -m 200M --memory-swap=300M centos-stress:1.0.1 --vm 1 --vm-bytes 280M
      stress: info: [1] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
      stress: dbug: [1] using backoff sleep of 3000us
      stress: dbug: [1] --> hogvm worker 1 [5] forked
      stress: dbug: [5] allocating 293601280 bytes ...
      stress: dbug: [5] touching bytes in strides of 4096 bytes ...
      stress: dbug: [5] freed 293601280 bytes
      stress: dbug: [5] allocating 293601280 bytes ...
      stress: dbug: [5] touching bytes in strides of 4096 bytes ...

      

    联系QQ :979873202 联系邮箱:979873202@qq.com
  • 相关阅读:
    51nod 1163 最高的奖励
    51nod 1191 消灭兔子
    51nod 2538 二三排列
    node做渲染服务器的实现
    gulp静态服务器的搭建
    canvas中裁切(橡皮檫)的应用--探照灯,点击去除遮罩
    canvas中图片、视频的加载(截图、切片)
    canvas中笔触基础知识
    Gitee的使用流程
    gulp的使用
  • 原文地址:https://www.cnblogs.com/cxbhakim/p/8472908.html
Copyright © 2011-2022 走看看