应用Dockfile构建一个命令行工具容器,能够灵便接管各种各样的参数

创立Dockerfile

ENTRYPOINT 用于启动时运行,CMD [] 用于接管参数。

FROM ubuntuRUN apt-get update && apt-get install -y stressENTRYPOINT ["/usr/bin/stress"]CMD []

编译镜像

docker build -t ubuntu-stress-tool .

调用容器

docker run ubuntu-stress-tool --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s