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

Reply via email to