Mesos Marathon Docker Containers – CommandInfo

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:

  • Multiple RUN vs. single chained RUN in Dockerfile, what is better?
  • Using docker-compose volumes_from option does not work
  • Cannot finde module 'express' (node app with docker)
  • Docker volume command line option mistaking files for directories
  • Docker and Mysql: libz.so.1: cannot open shared object file: Permission denied
  • How to use docker image, without mounting the default volumes?
  • 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!

  • Starting Consul in docker does not expose http ports
  • Installing Docker on an isolated (no internet) Centos 7 box?
  • Docker mac symfony 3 very slow
  • HBase on docker NotServingRegionException because of hostname alisas
  • Play Framework - Passing Application Arguments via Docker Container
  • TensorFlow with Docker
  • 2 Solutions collect form web for “Mesos Marathon Docker Containers – CommandInfo”

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

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.