You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mesos.apache.org by Javier Ruiz Jiménez <jr...@tecsisa.com> on 2014/08/29 00:45:17 UTC

Docker -p hostPort:containerPort in mesos 0.20.0

Hi All

I am translating all our Marathon API calls to new format for Marathon
0.7.0-SNAPSHOT
as we have upgraded to Mesos 0.20.0.

I used to map some container ports to well known host ports.

Example from when using Deimos:

 "options" : ["-p","9000:9000"]

Following Marathon upgrade guide in
https://mesosphere.github.io/marathon/docs/upgrade/06xto070.html

{
  "container": {
    "image": "docker:///megacorp/product:1.2.3",
    "options": [
      "-v", "/var/data/a:/etc/a:ro",
      "-v", "/var/data/b:/etc/b:rw",
      "-e", "FOO=bar",
      "-p", "443:443"
    ]
  }
}

Gets translated to:

{
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "megacorp/product:1.2.3"
    },
    "volumes": [
      {
        "hostPath": "/var/data/a",
        "containerPath": "/etc/a",
        "mode": "RO"
      },
      {
        "hostPath": "/var/data/b",
        "containerPath": "/etc/b",
        "mode": "RW"
      }
    ]
  },
  "env": {
    "FOO": "bar"
  },
  "ports": [443],
  "requirePorts": true
}

But if I do the same, docker ps shows no port mappings for the container.
No ports are mapped.

Any suggestions?
How can I see the "docker run command " that mesos executes?

Thanks,
Javier

RE: Docker -p hostPort:containerPort in mesos 0.20.0

Posted by Ted Young <ty...@guidewire.com>.
Hi,

I we are looking at upgrading to the latest Mesos + Marathon, but we need support of the Docker port forwarding (we had a modified version of the mesos-docker executor that worked nicely). Is there an existing way (using an alternate containerizer) that still supports Docker port forwarding for a container? Building from source is probably fine, if there's no released support yet.

Thanks,
;ted


From: Tim Chen [mailto:tim@mesosphere.io]
Sent: Thursday, August 28, 2014 6:40 PM
To: user@mesos.apache.org
Subject: Re: Docker -p hostPort:containerPort in mesos 0.20.0

Hi Steve,

Yes the plan is to put it in the next release.

Tim



On Thu, Aug 28, 2014 at 4:08 PM, Steve Domin <st...@gocardless.com>> wrote:
Hi Tim,

Do you think that's going to be part of the next release of Mesos?

Steve




On Thu, Aug 28, 2014 at 11:56 PM, Tim Chen <ti...@mesosphere.io>> wrote:
Hi Javier,

Like Ryan said the network mode is not configurable at the moment, I'm planning to add bridge network and port mappings next.

Thanks,

Tim

On Thu, Aug 28, 2014 at 3:51 PM, Ryan Thomas <r....@gmail.com>> wrote:

I believe that the docker containerizer in mesos is hard coded to use host-based networking at the moment. i.e. the --net=host flag.

This means that the ports the container binds to internally will be on the slaves interface and exposed.
On 29 Aug 2014 08:45, "Javier Ruiz Jiménez" <jr...@tecsisa.com>> wrote:
Hi All

I am translating all our Marathon API calls to new format for Marathon 0.7.0-SNAPSHOT as we have upgraded to Mesos 0.20.0.

I used to map some container ports to well known host ports.

Example from when using Deimos:

 "options" : ["-p","9000:9000"]

Following Marathon upgrade guide in https://mesosphere.github.io/marathon/docs/upgrade/06xto070.html

{
  "container": {
    "image": "docker:///megacorp/product:1.2.3",
    "options": [
      "-v", "/var/data/a:/etc/a:ro",
      "-v", "/var/data/b:/etc/b:rw",
      "-e", "FOO=bar",
      "-p", "443:443"
    ]
  }
}

Gets translated to:

{
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "megacorp/product:1.2.3"
    },
    "volumes": [
      {
        "hostPath": "/var/data/a",
        "containerPath": "/etc/a",
        "mode": "RO"
      },
      {
        "hostPath": "/var/data/b",
        "containerPath": "/etc/b",
        "mode": "RW"
      }
    ]
  },
  "env": {
    "FOO": "bar"
  },
  "ports": [443],
  "requirePorts": true
}

But if I do the same, docker ps shows no port mappings for the container. No ports are mapped.

Any suggestions?
How can I see the "docker run command " that mesos executes?

Thanks,
Javier





Re: Docker -p hostPort:containerPort in mesos 0.20.0

Posted by Tim Chen <ti...@mesosphere.io>.
Hi Steve,

Yes the plan is to put it in the next release.

Tim




On Thu, Aug 28, 2014 at 4:08 PM, Steve Domin <st...@gocardless.com> wrote:

> Hi Tim,
>
> Do you think that's going to be part of the next release of Mesos?
>
> Steve
>
>
>
>
>
> On Thu, Aug 28, 2014 at 11:56 PM, Tim Chen <ti...@mesosphere.io> wrote:
>
>> Hi Javier,
>>
>> Like Ryan said the network mode is not configurable at the moment, I'm
>> planning to add bridge network and port mappings next.
>>
>> Thanks,
>>
>> Tim
>>
>>
>> On Thu, Aug 28, 2014 at 3:51 PM, Ryan Thomas <r....@gmail.com>
>> wrote:
>>
>>> I believe that the docker containerizer in mesos is hard coded to use
>>> host-based networking at the moment. i.e. the --net=host flag.
>>>
>>> This means that the ports the container binds to internally will be on
>>> the slaves interface and exposed.
>>> On 29 Aug 2014 08:45, "Javier Ruiz Jiménez" <jr...@tecsisa.com> wrote:
>>>
>>>> Hi All
>>>>
>>>> I am translating all our Marathon API calls to new format for Marathon
>>>> 0.7.0-SNAPSHOT as we have upgraded to Mesos 0.20.0.
>>>>
>>>> I used to map some container ports to well known host ports.
>>>>
>>>> Example from when using Deimos:
>>>>
>>>>  "options" : ["-p","9000:9000"]
>>>>
>>>> Following Marathon upgrade guide in
>>>> https://mesosphere.github.io/marathon/docs/upgrade/06xto070.html
>>>>
>>>> {
>>>>   "container": {
>>>>     "image": "docker:///megacorp/product:1.2.3",
>>>>     "options": [
>>>>       "-v", "/var/data/a:/etc/a:ro",
>>>>       "-v", "/var/data/b:/etc/b:rw",
>>>>       "-e", "FOO=bar",
>>>>       "-p", "443:443"
>>>>     ]
>>>>   }
>>>> }
>>>>
>>>> Gets translated to:
>>>>
>>>> {
>>>>   "container": {
>>>>     "type": "DOCKER",
>>>>     "docker": {
>>>>       "image": "megacorp/product:1.2.3"
>>>>     },
>>>>     "volumes": [
>>>>       {
>>>>         "hostPath": "/var/data/a",
>>>>         "containerPath": "/etc/a",
>>>>         "mode": "RO"
>>>>       },
>>>>       {
>>>>         "hostPath": "/var/data/b",
>>>>         "containerPath": "/etc/b",
>>>>         "mode": "RW"
>>>>       }
>>>>     ]
>>>>   },
>>>>   "env": {
>>>>     "FOO": "bar"
>>>>   },
>>>>   "ports": [443],
>>>>   "requirePorts": true
>>>> }
>>>>
>>>> But if I do the same, docker ps shows no port mappings for the
>>>> container. No ports are mapped.
>>>>
>>>> Any suggestions?
>>>> How can I see the "docker run command " that mesos executes?
>>>>
>>>> Thanks,
>>>> Javier
>>>>
>>>>
>>
>

Re: Docker -p hostPort:containerPort in mesos 0.20.0

Posted by Steve Domin <st...@gocardless.com>.
Hi Tim,

Do you think that's going to be part of the next release of Mesos?

Steve





On Thu, Aug 28, 2014 at 11:56 PM, Tim Chen <ti...@mesosphere.io> wrote:

> Hi Javier,
>
> Like Ryan said the network mode is not configurable at the moment, I'm
> planning to add bridge network and port mappings next.
>
> Thanks,
>
> Tim
>
>
> On Thu, Aug 28, 2014 at 3:51 PM, Ryan Thomas <r....@gmail.com> wrote:
>
>> I believe that the docker containerizer in mesos is hard coded to use
>> host-based networking at the moment. i.e. the --net=host flag.
>>
>> This means that the ports the container binds to internally will be on
>> the slaves interface and exposed.
>> On 29 Aug 2014 08:45, "Javier Ruiz Jiménez" <jr...@tecsisa.com> wrote:
>>
>>> Hi All
>>>
>>> I am translating all our Marathon API calls to new format for Marathon 0
>>> .7.0-SNAPSHOT as we have upgraded to Mesos 0.20.0.
>>>
>>> I used to map some container ports to well known host ports.
>>>
>>> Example from when using Deimos:
>>>
>>>  "options" : ["-p","9000:9000"]
>>>
>>> Following Marathon upgrade guide in
>>> https://mesosphere.github.io/marathon/docs/upgrade/06xto070.html
>>>
>>> {
>>>   "container": {
>>>     "image": "docker:///megacorp/product:1.2.3",
>>>     "options": [
>>>       "-v", "/var/data/a:/etc/a:ro",
>>>       "-v", "/var/data/b:/etc/b:rw",
>>>       "-e", "FOO=bar",
>>>       "-p", "443:443"
>>>     ]
>>>   }
>>> }
>>>
>>> Gets translated to:
>>>
>>> {
>>>   "container": {
>>>     "type": "DOCKER",
>>>     "docker": {
>>>       "image": "megacorp/product:1.2.3"
>>>     },
>>>     "volumes": [
>>>       {
>>>         "hostPath": "/var/data/a",
>>>         "containerPath": "/etc/a",
>>>         "mode": "RO"
>>>       },
>>>       {
>>>         "hostPath": "/var/data/b",
>>>         "containerPath": "/etc/b",
>>>         "mode": "RW"
>>>       }
>>>     ]
>>>   },
>>>   "env": {
>>>     "FOO": "bar"
>>>   },
>>>   "ports": [443],
>>>   "requirePorts": true
>>> }
>>>
>>> But if I do the same, docker ps shows no port mappings for the
>>> container. No ports are mapped.
>>>
>>> Any suggestions?
>>> How can I see the "docker run command " that mesos executes?
>>>
>>> Thanks,
>>> Javier
>>>
>>>
>

Re: Docker -p hostPort:containerPort in mesos 0.20.0

Posted by Tim Chen <ti...@mesosphere.io>.
Hi Javier,

Like Ryan said the network mode is not configurable at the moment, I'm
planning to add bridge network and port mappings next.

Thanks,

Tim


On Thu, Aug 28, 2014 at 3:51 PM, Ryan Thomas <r....@gmail.com> wrote:

> I believe that the docker containerizer in mesos is hard coded to use
> host-based networking at the moment. i.e. the --net=host flag.
>
> This means that the ports the container binds to internally will be on the
> slaves interface and exposed.
> On 29 Aug 2014 08:45, "Javier Ruiz Jiménez" <jr...@tecsisa.com> wrote:
>
>> Hi All
>>
>> I am translating all our Marathon API calls to new format for Marathon 0
>> .7.0-SNAPSHOT as we have upgraded to Mesos 0.20.0.
>>
>> I used to map some container ports to well known host ports.
>>
>> Example from when using Deimos:
>>
>>  "options" : ["-p","9000:9000"]
>>
>> Following Marathon upgrade guide in
>> https://mesosphere.github.io/marathon/docs/upgrade/06xto070.html
>>
>> {
>>   "container": {
>>     "image": "docker:///megacorp/product:1.2.3",
>>     "options": [
>>       "-v", "/var/data/a:/etc/a:ro",
>>       "-v", "/var/data/b:/etc/b:rw",
>>       "-e", "FOO=bar",
>>       "-p", "443:443"
>>     ]
>>   }
>> }
>>
>> Gets translated to:
>>
>> {
>>   "container": {
>>     "type": "DOCKER",
>>     "docker": {
>>       "image": "megacorp/product:1.2.3"
>>     },
>>     "volumes": [
>>       {
>>         "hostPath": "/var/data/a",
>>         "containerPath": "/etc/a",
>>         "mode": "RO"
>>       },
>>       {
>>         "hostPath": "/var/data/b",
>>         "containerPath": "/etc/b",
>>         "mode": "RW"
>>       }
>>     ]
>>   },
>>   "env": {
>>     "FOO": "bar"
>>   },
>>   "ports": [443],
>>   "requirePorts": true
>> }
>>
>> But if I do the same, docker ps shows no port mappings for the container.
>> No ports are mapped.
>>
>> Any suggestions?
>> How can I see the "docker run command " that mesos executes?
>>
>> Thanks,
>> Javier
>>
>>

Re: Docker -p hostPort:containerPort in mesos 0.20.0

Posted by Ryan Thomas <r....@gmail.com>.
I believe that the docker containerizer in mesos is hard coded to use
host-based networking at the moment. i.e. the --net=host flag.

This means that the ports the container binds to internally will be on the
slaves interface and exposed.
On 29 Aug 2014 08:45, "Javier Ruiz Jiménez" <jr...@tecsisa.com> wrote:

> Hi All
>
> I am translating all our Marathon API calls to new format for Marathon 0
> .7.0-SNAPSHOT as we have upgraded to Mesos 0.20.0.
>
> I used to map some container ports to well known host ports.
>
> Example from when using Deimos:
>
>  "options" : ["-p","9000:9000"]
>
> Following Marathon upgrade guide in
> https://mesosphere.github.io/marathon/docs/upgrade/06xto070.html
>
> {
>   "container": {
>     "image": "docker:///megacorp/product:1.2.3",
>     "options": [
>       "-v", "/var/data/a:/etc/a:ro",
>       "-v", "/var/data/b:/etc/b:rw",
>       "-e", "FOO=bar",
>       "-p", "443:443"
>     ]
>   }
> }
>
> Gets translated to:
>
> {
>   "container": {
>     "type": "DOCKER",
>     "docker": {
>       "image": "megacorp/product:1.2.3"
>     },
>     "volumes": [
>       {
>         "hostPath": "/var/data/a",
>         "containerPath": "/etc/a",
>         "mode": "RO"
>       },
>       {
>         "hostPath": "/var/data/b",
>         "containerPath": "/etc/b",
>         "mode": "RW"
>       }
>     ]
>   },
>   "env": {
>     "FOO": "bar"
>   },
>   "ports": [443],
>   "requirePorts": true
> }
>
> But if I do the same, docker ps shows no port mappings for the container.
> No ports are mapped.
>
> Any suggestions?
> How can I see the "docker run command " that mesos executes?
>
> Thanks,
> Javier
>
>