2

Recently I setup Marathon, Mesos, and Docker across a few of my nodes. Everything is working well, except I'm encountering an issue when launching Docker containers. Specifically, when Marathon executes a task that launches a Docker container, marathon is appending /bin/sh -c ' ' as a default Docker command. This causes my containers to launch and then exit immediately (I can see that they launched by using docker ps -a)

I took a look at the Mesos documentation, which states:

A docker image currently supports having an entrypoint and/or a default command.

To run a docker image with the default command (ie: docker run image), the CommandInfo’s value must not be set. If the value is set then it will override the default command.

To run a docker image with an entrypoint defined, the CommandInfo’s shell option must be set to false. If shell option is set to true the Docker Containerizer will run the user’s command wrapped with /bin/sh -c which will also become parameters to the image entrypoint.

This is good information (I'm seeing the expected behavior from Mesos), but I don't see an option in Marathon to turn off the CommandInfo shell.

enter image description here

My question is:

  1. How do I set the CommandInfo Shell Option (either in Marathon or Mesos) to false? Where does that need to be set?

When I run my ghost-blog-test image on the machine (using the standard docker run command), it uses /entrypoint.sh npm s as its default command. I would like the same behavior when using Mesos+Marathon.

Thanks in advance!

Community
  • 1
  • 1
meoww-
  • 1,892
  • 2
  • 21
  • 29

2 Answers2

1

You need to define a command due to an issue (#2147) otherwise just not specifying a command should do the trick and run the default docker entrypoint.
The related bug is fixed in the newest (0.13) release but you need to use the API as there are still issues in the UI (#2749).

  • Hi Orlando, thanks for the insight. Yes, not specifying a command gives me the `bash -c ''` issue. I can, however, run this from the API and it works without any problems. Seems like theres a bug in the UI. – meoww- Dec 02 '15 at 03:22
  • Great to hear that! We have a fix for the UI in the pipeline ([#460](https://github.com/mesosphere/marathon-ui/pull/460)), so you should be able create such apps usign UI soon. – Orlando Hohmeier Dec 03 '15 at 09:47
0

According to the API docs

cmd (String)

The command that is executed. This value is wrapped by Mesos via /bin/sh -c ${app.cmd}. Either cmd or args must be supplied. It is invalid to supply both cmd and args in the same app.

args (Array of Strings)

An array of strings that represents an alternative mode of specifying the command to run. This was motivated by safe usage of containerizer features like a custom Docker ENTRYPOINT. This args field may be used in place of cmd even when using the default command executor. This change mirrors API and semantics changes in the Mesos CommandInfo protobuf message starting with version 0.20.0. Either cmd or args must be supplied. It is invalid to supply both cmd and args in the same app.

Rico
  • 58,485
  • 12
  • 111
  • 141