docker-stress icon indicating copy to clipboard operation
docker-stress copied to clipboard

Docker compose use

Open Buongiordanno opened this issue 6 years ago • 2 comments

Hi, how do i pass args (e.g. --cpu 2 --io 1) in a docker-compose.yml ?

version: '2' services: app01: image: progrium/stress cpu: 2 io: 1 vm: 2 vm-bytes: 128M timeout: 10s

this is what i've done, but it doesnt work, help me please.

Buongiordanno avatar Mar 27 '19 11:03 Buongiordanno

I think you could use command: https://docs.docker.com/compose/compose-file/#command Although you may have to also pass the entrypoint, e.gL

services:
  foo:
    command: /usr/bin/stress --verbose --cpu 2

I haven't tried this though :)

JoshKeegan avatar May 17 '19 10:05 JoshKeegan

There's a few gotchas here:

  • command has to be an array of arguments
  • arguments are appended to the entrypoint, so you don't need to specify that
  • arguments have to be strings, so you have to quote numbers:
# docker-compose.yaml
version: '3'

services:
  stress:
    image: progrium/stress
    command: [--cpu, "2"]

lbogdan avatar Sep 10 '19 11:09 lbogdan