Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to start nginx from marathon using docker

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to start nginx from marathon using docker". In daily operation, I believe many people have doubts about how to start nginx using docker from marathon. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use docker to start nginx from marathon". Next, please follow the editor to study!

If the program keeps deploy, there must be something wrong.

Mac installation

Brew install mesosbrew upgrade mesos

Start zookeeper start master

HOST_IP=100.80.128.98sudo / usr/local/Cellar/mesos/1.4.1/sbin/mesos-master-ip=$ {HOST_IP}\-log_dir=/Users/lifei/dockerproject/mesos/master/log-work_dir=/Users/lifei/dockerproject/mesos/master/work\-ZK=zk://$ {HOST_IP}: 2181/mesos-quorum=1

Start slave (pay attention to the port, if a port such as 80 is used in marathon, the ports range needs to be large enough)

/ usr/local/Cellar/mesos/1.4.1/sbin/mesos-slave-- help View help launch the first slavesudo / usr/local/Cellar/mesos/1.4.1/sbin/mesos-slave-- master=$ {HOST_IP}: 5050\-- log_dir=/Users/lifei/dockerproject/mesos/slave/log-- work_dir=/Users/lifei/dockerproject/mesos/slave/work\-- containerizers=docker Mesos-no-hostname_lookup-ip=$ {HOST_IP}-resources='ports: [1-32000] 'start the second slavesudo / usr/local/Cellar/mesos/1.4.1/sbin/mesos-slave-- master=$ {HOST_IP}: 5050\-- log_dir=/Users/lifei/dockerproject/mesos/slave/log2-- work_dir=/Users/lifei/dockerproject/mesos/slave/work2\-- containerizers=docker,mesos-- no-hostname_lookup-- ip=$ {HOST_IP}-- resources='ports: [1-32000];

Test task

/ usr/local/Cellar/mesos/1.4.1/bin/mesos-execute-master=localhost:5050-name=hellomesos-command= "echo 'hello,mesos'"

Start marathon

Sudo. / bin/start-- http_port 8088-- master ${HOST_IP}: 5050-- zk zk://$ {HOST_IP}: 2181/marathon-h ${HOST_IP}

Test marathon

Commandwhile [true]; do echo 'Hello Marathon'; sleep 5; done

Start nginx from marathon using docker

{"type": "DOCKER", "volumes": [], "docker": {"image": "library/nginx", "network": "BRIDGE", "portMappings": [{"containerPort": 80, "hostPort": 0, "servicePort": 2000, "protocol": "tcp", "labels": {}}] "privileged": false, "parameters": [], "forcePullImage": false}} using docker inspect containerid Look at the dynamically allocated hostportps: in container, this web service runs on port 8080 (the value of containerPort). Outside of container, Marathon assigns a random port (hostPort setting is 0)

Marathon-lb installation

Using bridge mode, host mode failed Do not understand where the problem lies * {"id": "/ marathon-lb", "cmd": null, "cpus": 1, "mem": 128, "disk": 0, "instances": 1, "constraints": [["hostname", "UNIQUE"]], "container": {"type": "DOCKER" "volumes": [{"containerPath": "/ var", "hostPath": "/ Users/lifei/dockerproject/marathon/marathon-lb-var", "mode": "RW"}, {"containerPath": "/ tmp", "hostPath": "/ Users/lifei/dockerproject/marathon/marathon-lb-tmp" "mode": "RW"}], "docker": {"image": "docker.io/mesosphere/marathon-lb", "network": "BRIDGE", "portMappings": [{"containerPort": 80, "hostPort": 80, "servicePort": 10001, "protocol": "tcp" "labels": {}}, {"containerPort": 9090, "hostPort": 9090, "servicePort": 10002, "protocol": "tcp", "labels": {}}], "privileged": true, "parameters": [], "forcePullImage": false}} "portDefinitions": [{"port": 10001, "protocol": "tcp", "labels": {}}, {"port": 10002, "protocol": "tcp", "labels": {}}], "args": ["sse", "- m", "http://100.80.128.98:8088","-group " "external"]}

Test marathon-lb

{"id": "/ test-lb-nginx", "cmd": null, "cpus": 0.2, "mem": 20, "disk": 0, "instances": 2, "container": {"type": "DOCKER", "volumes": [], "docker": {"image": "docker.io/nginx", "network": "BRIDGE" "portMappings": [{"containerPort": 80, "hostPort": 0, "servicePort": 80, "protocol": "tcp", "labels": {}}], "privileged": false, "parameters": [], "forcePullImage": false}} "healthChecks": [{"path": "/", "protocol": "HTTP", "portIndex": 0, "gracePeriodSeconds": 300, "intervalSeconds": 60, "timeoutSeconds": 20, "maxConsecutiveFailures": 3, "ignoreHttp1xx": false}], "labels": {"HAPROXY_GROUP": "external" "HAPROXY_0_VHOST": "nginx.marathon.mesos"}, "portDefinitions": [{"port": 80, "protocol": "tcp", "labels": {}}]}

Test url

Http://100.80.128.98:9090/haproxy?statshttp://100.80.128.98 at this point, on "how to use docker from marathon to start nginx" study is over, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report