Search code examples
dockermesosmarathon

Marathon cannot run an Application which is in docker container


I have three node with docker installed on them. In master node, I run Mesos and Marathon without any problems. The details are in following: First I enter to the docker with this command:

  docker run -v /home/user/.ssh:/root/.ssh --privileged -p 
   5050:5050 -p 5051:5051 -p 5052:5052 -p 2181:2181 -p 8082:8081 
   -p 6123:6123 -p 8080:8080 -p 50090:50090 -p 50070:50070 -p 
   9000:9000 -p 2888:2888 -p 3888:3888 -p 4041:4040 -p 7077:7077 
   -p 52222:22 -e WEAVE_CIDR=10.32.0.2/12 
   -e MESOS_EXECUTOR_REGISTRATION_TIMEOUT=5mins 
   -e LIBPROCESS_IP=10.32.0.2 
   -e MESOS_RESOURCES=ports*:[11000-11999] 
   -ti hadoop_marathon_mesos_flink_2 /bin/bash

Then I run these commands for Zookeeper and Mesos:

 /home/zookeeper-3.4.14/bin/zkServer.sh restart

 /home/mesos-1.7.2/build/bin/mesos-master.sh --ip=10.32.0.1 
   --hostname=10.32.0.1 --roles=marathon,flink --quorum=1 
   --work_dir=/var/run/mesos --log_dir=/var/log/mesos

After running Mesos, I open another terminal to run Marathon:

  docker run exec -it container-id /bin/bash

Then I run Marathon without any issues:

  /home/marathon-1.7.189-48bfd6000/bin/marathon 
  --master 10.32.0.1:5050 --zk zk://10.32.0.1:2181/marathon 
  --hostname 10.32.0.1 --webui_url 10.32.0.1:8080 
  --logging_level debug

To test Marathon, I write a simple scipt to print a string and it works fine in docker container. But when I create a new Application to run the script, it does not run because of this error:

I0428 05:32:09.167528 5115 exec.cpp:162] Version: 1.7.2

I0428 05:32:09.177440 5117 exec.cpp:236] Executor registered on agent 984595ae-e811-48fb-a9f5-ca6128e1cc1a-S0

I0428 05:32:09.179848 5120 executor.cpp:188] Received SUBSCRIBED event

I0428 05:32:09.180785 5120 executor.cpp:192] Subscribed executor on 10.32.0.3

I0428 05:32:09.180997 5120 executor.cpp:188] Received LAUNCH event

I0428 05:32:09.182319 5120 executor.cpp:697] Starting task test.f76ace45-6976-11e9-928f-ce235caa831e

I0428 05:32:09.196890 5120 executor.cpp:712] Forked command at 5124 sh: 1: /home/test.sh: not found

I0428 05:32:09.369120 5119 executor.cpp:1013] Command exited with status 127 (pid: 5124)

I0428 05:32:10.376525 5123 process.cpp:927] Stopped the socket accept loop

It means that Marathon does not know about the Application which is in docker container. Would you please guide me how to solve this problem? I also set Docker image in Marathon, but the task failed again and the Mesos UI does not have any log in SandBox.

Please help me.

Thank you in advance.


Solution

  • Problem solved. I must put the Application on the docker container in Slave nodes. I did that and the Application is run in Marathon.