1

How can I host an application in ACS (DCOS) on any other port except 80? Can I give any other URL instead of using port number to access?

{
 "id": "/dockercloud-hello-world",
 "cmd": null,
 "cpus": 0.1,
 "mem": 128,
 "disk": 0,
 "instances": 2,
 "acceptedResourceRoles": [
   "*"
 ],
 "container": {
   "type": "DOCKER",
   "volumes": [],
   "docker": {
     "image": "dockercloud/hello-world",
     "network": "BRIDGE",
     "portMappings": [
       {
         "containerPort": 80,
         "hostPort": 0,
         "servicePort": 10000,
         "protocol": "tcp",
         "labels": {}
       }
     ],
     "privileged": false,
     "parameters": [],
     "forcePullImage": true
   }
 },

 "portDefinitions": [
   {
     "port": 10000,
     "protocol": "tcp",
     "name": "default",
     "labels": {}
   }
 ]
}

Application is available on port 4170 according to Marathon.

I am unable to access from agents fqn:portnumber

Saca
  • 10,355
  • 1
  • 34
  • 47
Sumanth Itha
  • 89
  • 1
  • 9
  • I have tried adding all the rules mentioned in the URL https://learn.microsoft.com/en-us/azure/container-service/dcos-swarm/container-service-enable-public-access – Sumanth Itha Mar 06 '18 at 09:27

1 Answers1

2

Yes, it is possible.

Firstly, you need modify hostPort value to 4170 and acceptedResourceRoles to slave_public.

Then you need open port 4170 on agent node NSG.

enter image description here

Then you also need open port on agent node LB.

1.Add Health probes

enter image description here

2.Load balancing rules

enter image description here

More information about this please check this link.

Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
  • I test in my lab, it works for me. You could access my image http://shuidcagents.centralus.cloudapp.azure.com:4170/ – Shui shengbao Mar 06 '18 at 09:26
  • I have tried working on suggestions provided still unable to view https://imgur.com/a/mW6dX – Sumanth Itha Mar 06 '18 at 10:51
  • @user2547194 It seems no issue for your configuration, what is your agent ip? – Shui shengbao Mar 07 '18 at 01:55
  • If you try listen your container on 8080(the port is open on default)? what is the result? – Shui shengbao Mar 07 '18 at 05:13
  • I did not change "acceptedResourceRoles": [ "*" ] to slave_public. After change its working. Thanks for the support. can we have a differnt url like helloworld.dcos.com? – Sumanth Itha Mar 07 '18 at 07:11
  • Ok. can we have a different url like helloworld.dcos.com instead of accessing from the port numbers?? Will scaling of the application be a problem when we are using static ports? – Sumanth Itha Mar 07 '18 at 07:18
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/166374/discussion-between-shengbao-shui-msft-and-user2547194). – Shui shengbao Mar 07 '18 at 07:19