10. Write linux command line tools Dockerfile

Linux pressure testing tools

A. Practice

1. Create a container ubuntu

  docker run -it ubuntu

2. Install stress tool

  apt-get update && apt-get install -y stress

3. stress command

  stress --vm [number] labeled create several processes

     How many bytes --vm-bytes [number] allocate memory for each process a default 256M memory 

       --Verbose cycle distribution process to create and release

  If you allocate too much memory error will be reported if the memory limits (no more than the memory of the host)

    eg: stress --vm 1 --vm-bytes 50000M --verbose will error

 

II. DockerFile used for running manner ENTRYPOINT + CMD dynamically input parameters

  1. Create ubuntu-stress and enter the ubuntu-stress

    mkdir ubuntu-stress && cd ubuntu-stress

  2. Create and written Dockerfile

    FROM ubuntu

    RUN apt-get update && apt-get install -y stress

    ENTRYPOINT ["/usr/bin/stress"]

    CMD []

  3. The image generated by the docker build

    docker build -t [image_name] .

  3. Use docker run the incoming parameters

    eg: docker run -it [image_name] --vm 1 --verbose # cycle will allocate memory and print mine village

    

Guess you like

Origin www.cnblogs.com/zonehoo/p/11288269.html