Docker when deployed on marathon is failing continously

I am new to these technologies and trying to figure things out. So, I followed the basic tutorials provided by Mesosphere and was able to create a cluster locally (two VMs) now I want to deploy a nodejs application so I created a docker image which contains nodejs express framework and a script which just start the server. You can find the docker image at docker registry as pujariamol/nodejs-express and it has a script at root level called as runScript.sh.

The JSON that I tried for deploying it is as follows:

  • Unable to pull the images in docker on Windows
  • Kafka - Docker - Error when sending message from Host to Container (Batch Expired)
  • Trouble using AUFS driver in docker with Ubuntu
  • Docker containers linking
  • Enable webcam in docker application and access thru AWS ECS
  • Docker compose linking appears to not work
  • {
        "id": "app4", 
        "container": {
            "type":"DOCKER",
          "docker": {
            "image": "pujariamol/nodejs-express"
          }
        },
        "cmd":"echo hello > /tmp/out.txt",
        "cpus": 0.25,
        "mem": 512.0,
        "instances": 1
    }
    

    I thought this will pull my docker container and will start it. Also, I wanted to run runScript.sh so I was trying ‘./runScript.sh’ in cmd but it didn’t work so I tried writing some text in out.txt for testing purpose but nothing seems to work. The moment the application is deployed the mesos shows Failed status for this app.
    I am using chrome extension postman for deploying it on marathon.
    I have no idea what is going wrong. Please help me with getting this application deployed on Marathon and let me know if you need any more information.

    Thanks in advance.

  • Can RStudio (IDE NOT server) be configured to use remote R setup?
  • How to bring a running docker container again foreground
  • How to use kvm in a Centos 6 docker container via docker machine
  • Docker blocking outgoing connections on high load?
  • Docker Run With SELinux on ubuntu Constrain violation
  • How can I create ubuntu based docker host by using docker-machine with VirtualBox?
  • 2 Solutions collect form web for “Docker when deployed on marathon is failing continously”

    I don’t know Mesosphere at all, but if you are trying to run this in a container:

    echo hello > /tmp/out.txt
    

    …then your container is going to be very, very short lived. A Docker container only runs as long as your initial command, and echo is simply going to exit immediately.

    Are you able to start the container successfully using docker run by itself, without involving mesosphere? Have you looked at the container logs to see if there are any useful errors? You can use docker logs for this, and it’s possible that Mesosphere provides an interface to this information.

    If you are trying to run ./runScript.sh, are you certain that there is a script named runScript.sh in the current directory when the container starts? It would have to be located in the root directory (/) for this to work. It’s generally better to provide a full path to your initial command (e.g., /runScript.sh, or /usr/local/something/runScript.sh).

    Thank you Larsks for the reply.
    Yes I checked the container and scripts individually they were working fine. Though it is working now, I am not sure if this is the reason. So, I assume it was happening because I was running the container on my virtual machine and I was creating a job from a postman which was on my host machine (Windows8) and it never worked for runScript.sh. So, I tried it from within the VM using CURL cmd and it worked and I can access the container server too just that I have to find out the container IP address and then try to access it. So now will be trying to figure out how to access these servers from a single URL.
    Anyway thank you Larsks, I didn’t know that the containers will be short lived for such commands before I read your comment.

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