Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker compose use #2

Open
Buongiordanno opened this issue Mar 27, 2019 · 2 comments
Open

Docker compose use #2

Buongiordanno opened this issue Mar 27, 2019 · 2 comments

Comments

@Buongiordanno
Copy link

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.

@JoshKeegan
Copy link

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 :)

@lbogdan
Copy link

lbogdan commented Sep 10, 2019

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"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants