[ 
https://issues.apache.org/jira/browse/AURORA-633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14118532#comment-14118532
 ] 

Anindya Sinha edited comment on AURORA-633 at 9/2/14 6:59 PM:
--------------------------------------------------------------

Since 'task = Required(Task)', no change is being proposed to 'MesosJob (or 
Job)'. Instead, support for docker in aurora is being proposed to be within the 
'Task' as follows:

1) In 'Task', an optional field 'container' (of type 'Container' - a new Struct 
defined in #2 below) is being added. One of processes or container must be 
present in Task definition.
2) Definition of Container is as follows. Note that volumes is a list of Volume 
defined below (in #3):
'
class Container(Struct):
  name = Default(String, "{{image}}")
  image = Required(String)
  type = Default(String, "docker") -> The only valid value right now is docker
  volumes = Default(List(Volume), [])
'
3) Definition of a volume is as follows:
'
class Volume(Struct):
  name = Default(String, "{{container_path}}")
  container_path = Required(String)
  host_path = Required(String)
  mode = Default(String, "RO") -> Note that this can be RO or RW
'
4) Added a 'Docker()' as follows (like 'Service = Job(service=True)'):
'
  Docker = Container(type="docker")
'

As an example:
'
task = Task(
  name = "task_hello",
  container = Docker(
    name = "docker_hello",
    image = "centos:6u5",
    volumes = [
        Volume(
            name = "v1",
            container_path = "/cnt1",
            host_path = "/host1"),
        Volume(
            name = "v2",
            container_path = "/cnt2",
            host_path = "/host2",
            mode = "RW")
            ]
  ),
  processes = [hello],
  constraints = order(hello),
  resources = Resources(cpu = 1.0, ram = 128*MB, disk = 128*MB))

jobs = [Service(task = task, ...)]
'


was (Author: anindya.sinha):
Since task = Required(Task), no change is being proposed to MesosJob (or Job). 
Instead, support for docker in aurora is being proposed to be within the Task 
as follows:

1) In Task, an optional field 'container' (of type Container - a new Struct 
defined in #2 below) is being added. One of processes or container must be 
present in Task definition.
2) Definition of Container is as follows. Note that volumes is a list of Volume 
defined below (in #3):
class Container(Struct):
  name = Default(String, '{{image}}')
  image = Required(String)
  type = Default(String, 'docker') -> The only valid value right now is 'docker'
  volumes = Default(List(Volume), [])
3) Definition of a volume is as follows:
class Volume(Struct):
  name = Default(String, '{{container_path}}')
  container_path = Required(String)
  host_path = Required(String)
  mode = Default(String, 'RO') -> Note that this can be 'RO' or 'RW'
4) Added a Docker() as follows (like 'Service = Job(service=True)'):
  Docker = Container(type='docker')

As an example:
task = Task(
  name = 'task_hello',
  container = Docker(
    name = 'docker_hello',
    image = 'centos:6u5',
    volumes = [
        Volume(
            name = 'v1',
            container_path = '/cnt1',
            host_path = '/host1'),
        Volume(
            name = 'v2',
            container_path = '/cnt2',
            host_path = '/host2',
            mode = 'RW')
            ]
  ),
  processes = [hello],
  constraints = order(hello),
  resources = Resources(cpu = 1.0, ram = 128*MB, disk = 128*MB))

jobs = [Service(task = task, ...)]

> Support running Docker containers
> ---------------------------------
>
>                 Key: AURORA-633
>                 URL: https://issues.apache.org/jira/browse/AURORA-633
>             Project: Aurora
>          Issue Type: Epic
>          Components: Client, Scheduler
>            Reporter: Jay Buffington
>            Assignee: Jay Buffington
>
> Mesos 0.20 will be released soon, and it will likely include support for a 
> docker containerizer.  See MESOS-1524.
> To make use of this feature, I propose modifying aurora's DSL to support 
> running docker containers both with and without the aurora executor.
> Task would be changed to introduce a container field and make processes 
> optional when a container is specified.  A Task to launch a Docker container 
> using the entry point (aka command) specified in the container would look 
> like this:
> {noformat}
> Task(
>     name="my-task",
>     container=Docker(
>         image="docker:///centos:6u5',
>     ),
>     resources=Resources(cpu=1, disk=10*GB, ram=1*GB)
> )
> {noformat}
> If you specify processes in your Task then the docker containerizer will 
> fetch and launch the aurora executor for you.  This would run {{process_a}} 
> then {{process_b}} inside the same docker container using the aurora executor:
> {noformat}
> Task(
>     name="my-task",
>     container=Docker(
>         image="docker:///centos:6u5',
>     ),
>     processes=[process_a, process_b],
>     constraints=order(process_a, process_b),
>     resources=Resources(cpu=1, disk=10*GB, ram=1*GB)
> )
> {noformat}
> The Docker() struct would closely model the fields that will be in the 
> DockerInfo protobuf message detailed here: 
> https://github.com/tnachen/mesos/wiki/DockerInfo-design



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to