When I tried passing arguments as an array yesterday I got this output from Chronos:
+ logged chronos run_jar '--master zk://...:2181/mesos' '--zk_hosts zk://...:2181' So more quotes. Then I added `shell: false` and it worked, so I thought that fixed it. However, today if I destroy Chronos and run redeploy without `shell: false`, it still works fine, and the arguments do not have quotes. I'm not sure what is going on here. Just a guess: Does Marathon cache some config when I use the same ID? Did passing `shell: false` force this cache to clear? I may also have changed the ID myself, but I can't remember now. I never used `cmd`, just `args`. Andrew On Wed, Oct 29, 2014, at 04:59 PM, Connor Doyle wrote: > Andrew, could you explain what you changed to make this work? > > Marathon doesn't expose a `shell` argument; it's set implicitly by using > either `cmd` or `args` in the app JSON. `args` is what you want (sets > shell to false) if you are using a Dockerfile with an ENTRYPOINT clause. > `args` is an array, and it looks like Mesos is wrapping each argument in > quotes. Did you try passing the arguments as separate array elements? > > > >>> "args": ["--master zk://...:2181/mesos --zk_hosts zk:/...:2181"], > > "args": ["--master", "zk://...:2181/mesos", "--zk_hosts", > "zk:/...:2181"], > > -- > Connor > > > On Oct 29, 2014, at 9:44, Andrew Jones <andrew+me...@andrew-jones.com> > wrote: > > > Thanks a lot TIm. That worked perfectly. > > > > Thanks, > > Andrew > > > > On Wed, Oct 29, 2014, at 03:58 PM, Timothy Chen wrote: > >> Hi Andrew, > >> > >> By default shell is enabled, which wraps your command in bin/sh and > >> single quotes. > >> > >> Try passing shell false to marathon. > >> > >> Tim > >> > >> Sent from my iPhone > >> > >>> On Oct 29, 2014, at 4:44 AM, Andrew Jones <andrew+me...@andrew-jones.com> > >>> wrote: > >>> > >>> Hi, > >>> > >>> I'm trying to run a Docker image which has a defined entrypoint and pass > >>> args to it. It looks like when the args are passed to docker run, they > >>> are surrounded by single quotes. > >>> > >>> The image I am trying to run is tomaskral/chronos, and this is the > >>> configuration I am giving to Marathon: > >>> > >>> { > >>> "id": "chronos-test-2", > >>> "container": { > >>> "docker": { > >>> "image": "tomaskral/chronos", > >>> "network": "BRIDGE", > >>> "portMappings": [ > >>> { > >>> "containerPort": 8080, > >>> "hostPort": 0, > >>> "servicePort": 31000, > >>> "protocol": "tcp" > >>> } > >>> ] > >>> }, > >>> "type": "DOCKER", > >>> "volumes": [] > >>> }, > >>> "ports":[31000], > >>> "args": ["--master zk://...:2181/mesos --zk_hosts zk:/...:2181"], > >>> "cpus": 0.2, > >>> "mem": 256.0, > >>> "instances": 1 > >>> } > >>> > >>> And this is an extract from the log from Mesos when the image is ran: > >>> > >>> + logged chronos run_jar '--master zk://...:2181/mesos --zk_hosts > >>> zk://...:2181' > >>> > >>> The argument has single quotes around it. run_jar is calling java, which > >>> cannot handle the quotes, and the process isn't starting. > >>> > >>> If I run the image locally with docker run like this, it works: > >>> > >>> docker run -p 8080:8080 tomaskral/chronos --master zk://...:2181/mesos > >>> --zk_hosts zk://...:2181 > >>> > >>> But adding quotes, like this, and I get the same output as I did from > >>> Mesos: > >>> > >>> docker run -p 8080:8080 tomaskral/chronos '--master zk://...:2181/mesos > >>> --zk_hosts zk://...:2181' > >>> > >>> So I think these quotes are being added by either Marathon or Mesos when > >>> calling docker run, which the java command inside the container can't > >>> handle. > >>> > >>> Is it Mesos or Marathon adding the quotes? Is this something that should > >>> be fixed, or should the docker images expect this and cope? > >>> > >>> This is Mesos 0.21.1 and Marathon 0.7.3. I have also asked the author of > >>> the image for help (https://github.com/kadel/Dockerfiles/issues/3). > >>> > >>> Thanks, > >>> Andrew >