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:
{
"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.
I don't know Mesosphere at all, but if you are trying to run this in a container:
...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 usedocker 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 namedrunScript.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
).