You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Frank Scholten <fr...@frankscholten.nl> on 2015/11/25 11:48:54 UTC

Mesos Flocker - Custom Isolator and Docker

Hi all,

We (Frank Scholten and Phil Winder) are currently developing the Mesos
Flocker framework. As part of this framework we want to develop a
custom isolator module which interacts with the Flocker Control
Service.

After creating a simple stub isolator and installing it on one of the
agents we noticed it gets picked up we run a regular task but it does
not get picked up when we run a Docker container.

To us it seems that this is because isolators can only be used by the
MesosContainerizer. The MesosContainerizer configures isolation in its
create factory method while the DockerContainerizes does not:

MesosContainerizer

Try<MesosContainerizer*> MesosContainerizer::create(
    const Flags& flags,
    bool local,
    Fetcher* fetcher)
{
  string isolation;

  if (flags.isolation == "process") {
    LOG(WARNING) << "The 'process' isolation flag is deprecated, "
                 << "please update your flags to"
                 << " '--isolation=posix/cpu,posix/mem'.";

    isolation = "posix/cpu,posix/mem";
  } else if (flags.isolation == "cgroups") {
    LOG(WARNING) << "The 'cgroups' isolation flag is deprecated, "
                 << "please update your flags to"
                 << " '--isolation=cgroups/cpu,cgroups/mem'.";

    isolation = "cgroups/cpu,cgroups/mem";
  } else {
    isolation = flags.isolation;
  }

DockerContainerizer

Try<DockerContainerizer*> DockerContainerizer::create(
    const Flags& flags,
    Fetcher* fetcher)
{
  Try<Docker*> create = Docker::create(flags.docker, flags.docker_socket, true);
  if (create.isError()) {
    return Error("Failed to create docker: " + create.error());
  }

  Shared<Docker> docker(create.get());

  if (flags.docker_mesos_image.isSome()) {
    Try<Nothing> validateResult = docker->validateVersion(Version(1, 5, 0));
    if (validateResult.isError()) {
      string message = "Docker with mesos images requires docker 1.5+";
      message += validateResult.error();
      return Error(message);
    }
  }

  return new DockerContainerizer(flags, fetcher, docker);
}

The question now is how can we create an isolator to work together
with the DockerContainerizer. Should we subclass the
DockerContainerizer and create a FlockerContainerizer instead? Any
other suggestions?

Thanks in advance.

Cheers,

Frank and Phil

Re: Mesos Flocker - Custom Isolator and Docker

Posted by Vaibhav Khanduja <va...@gmail.com>.
Does this not satisfy the usecase? ->
https://github.com/ClusterHQ/mesos-module-flocker

On Thu, Nov 26, 2015 at 3:26 AM, Timothy Chen <tn...@gmail.com> wrote:

> Hi Tommy,
>
> We didn't modify MesosContainerizer container creation but only just
> added image support and the ability to inherit runtime configuration
> from images.
>
> We're considering different options like runc for OCI but still just
> investigating, if you have any more thoughts let us know!
>
> Tim
>
> On Wed, Nov 25, 2015 at 8:05 AM, tommy xiao <xi...@gmail.com> wrote:
> > Tim,
> >
> > interesting on the MesosContainerizer's design, what technology to
> support
> > it? runC solution?
> >
> > 2015-11-25 19:09 GMT+08:00 Timothy Chen <tn...@gmail.com>:
> >
> >> Hi there,
> >>
> >> DockerContainerizer doesn't support isolators simply because we
> >> delegate all container creation to Docker via docker client, and
> >> therefore we don't have a way to run our isolators that's in
> >> mesos-slave from docker.
> >>
> >> We're working on unified containerizer that brings Docker images to
> >> Mesos Containerizer, so you can launch containers with docker images
> >> with it. There is a working initial code that's already in master that
> >> you can try out, and once you have the isolator you can then launch
> >> containers with docker images with your new isolator with
> >> MesosContainerizer.
> >>
> >> Tim
> >>
> >> On Wed, Nov 25, 2015 at 2:48 AM, Frank Scholten <frank@frankscholten.nl
> >
> >> wrote:
> >> > Hi all,
> >> >
> >> > We (Frank Scholten and Phil Winder) are currently developing the Mesos
> >> > Flocker framework. As part of this framework we want to develop a
> >> > custom isolator module which interacts with the Flocker Control
> >> > Service.
> >> >
> >> > After creating a simple stub isolator and installing it on one of the
> >> > agents we noticed it gets picked up we run a regular task but it does
> >> > not get picked up when we run a Docker container.
> >> >
> >> > To us it seems that this is because isolators can only be used by the
> >> > MesosContainerizer. The MesosContainerizer configures isolation in its
> >> > create factory method while the DockerContainerizes does not:
> >> >
> >> > MesosContainerizer
> >> >
> >> > Try<MesosContainerizer*> MesosContainerizer::create(
> >> >     const Flags& flags,
> >> >     bool local,
> >> >     Fetcher* fetcher)
> >> > {
> >> >   string isolation;
> >> >
> >> >   if (flags.isolation == "process") {
> >> >     LOG(WARNING) << "The 'process' isolation flag is deprecated, "
> >> >                  << "please update your flags to"
> >> >                  << " '--isolation=posix/cpu,posix/mem'.";
> >> >
> >> >     isolation = "posix/cpu,posix/mem";
> >> >   } else if (flags.isolation == "cgroups") {
> >> >     LOG(WARNING) << "The 'cgroups' isolation flag is deprecated, "
> >> >                  << "please update your flags to"
> >> >                  << " '--isolation=cgroups/cpu,cgroups/mem'.";
> >> >
> >> >     isolation = "cgroups/cpu,cgroups/mem";
> >> >   } else {
> >> >     isolation = flags.isolation;
> >> >   }
> >> >
> >> > DockerContainerizer
> >> >
> >> > Try<DockerContainerizer*> DockerContainerizer::create(
> >> >     const Flags& flags,
> >> >     Fetcher* fetcher)
> >> > {
> >> >   Try<Docker*> create = Docker::create(flags.docker,
> >> flags.docker_socket, true);
> >> >   if (create.isError()) {
> >> >     return Error("Failed to create docker: " + create.error());
> >> >   }
> >> >
> >> >   Shared<Docker> docker(create.get());
> >> >
> >> >   if (flags.docker_mesos_image.isSome()) {
> >> >     Try<Nothing> validateResult = docker->validateVersion(Version(1,
> 5,
> >> 0));
> >> >     if (validateResult.isError()) {
> >> >       string message = "Docker with mesos images requires docker
> 1.5+";
> >> >       message += validateResult.error();
> >> >       return Error(message);
> >> >     }
> >> >   }
> >> >
> >> >   return new DockerContainerizer(flags, fetcher, docker);
> >> > }
> >> >
> >> > The question now is how can we create an isolator to work together
> >> > with the DockerContainerizer. Should we subclass the
> >> > DockerContainerizer and create a FlockerContainerizer instead? Any
> >> > other suggestions?
> >> >
> >> > Thanks in advance.
> >> >
> >> > Cheers,
> >> >
> >> > Frank and Phil
> >>
> >
> >
> >
> > --
> > Deshi Xiao
> > Twitter: xds2000
> > E-mail: xiaods(AT)gmail.com
>

Re: Mesos Flocker - Custom Isolator and Docker

Posted by Timothy Chen <tn...@gmail.com>.
Hi Tommy,

We didn't modify MesosContainerizer container creation but only just
added image support and the ability to inherit runtime configuration
from images.

We're considering different options like runc for OCI but still just
investigating, if you have any more thoughts let us know!

Tim

On Wed, Nov 25, 2015 at 8:05 AM, tommy xiao <xi...@gmail.com> wrote:
> Tim,
>
> interesting on the MesosContainerizer's design, what technology to support
> it? runC solution?
>
> 2015-11-25 19:09 GMT+08:00 Timothy Chen <tn...@gmail.com>:
>
>> Hi there,
>>
>> DockerContainerizer doesn't support isolators simply because we
>> delegate all container creation to Docker via docker client, and
>> therefore we don't have a way to run our isolators that's in
>> mesos-slave from docker.
>>
>> We're working on unified containerizer that brings Docker images to
>> Mesos Containerizer, so you can launch containers with docker images
>> with it. There is a working initial code that's already in master that
>> you can try out, and once you have the isolator you can then launch
>> containers with docker images with your new isolator with
>> MesosContainerizer.
>>
>> Tim
>>
>> On Wed, Nov 25, 2015 at 2:48 AM, Frank Scholten <fr...@frankscholten.nl>
>> wrote:
>> > Hi all,
>> >
>> > We (Frank Scholten and Phil Winder) are currently developing the Mesos
>> > Flocker framework. As part of this framework we want to develop a
>> > custom isolator module which interacts with the Flocker Control
>> > Service.
>> >
>> > After creating a simple stub isolator and installing it on one of the
>> > agents we noticed it gets picked up we run a regular task but it does
>> > not get picked up when we run a Docker container.
>> >
>> > To us it seems that this is because isolators can only be used by the
>> > MesosContainerizer. The MesosContainerizer configures isolation in its
>> > create factory method while the DockerContainerizes does not:
>> >
>> > MesosContainerizer
>> >
>> > Try<MesosContainerizer*> MesosContainerizer::create(
>> >     const Flags& flags,
>> >     bool local,
>> >     Fetcher* fetcher)
>> > {
>> >   string isolation;
>> >
>> >   if (flags.isolation == "process") {
>> >     LOG(WARNING) << "The 'process' isolation flag is deprecated, "
>> >                  << "please update your flags to"
>> >                  << " '--isolation=posix/cpu,posix/mem'.";
>> >
>> >     isolation = "posix/cpu,posix/mem";
>> >   } else if (flags.isolation == "cgroups") {
>> >     LOG(WARNING) << "The 'cgroups' isolation flag is deprecated, "
>> >                  << "please update your flags to"
>> >                  << " '--isolation=cgroups/cpu,cgroups/mem'.";
>> >
>> >     isolation = "cgroups/cpu,cgroups/mem";
>> >   } else {
>> >     isolation = flags.isolation;
>> >   }
>> >
>> > DockerContainerizer
>> >
>> > Try<DockerContainerizer*> DockerContainerizer::create(
>> >     const Flags& flags,
>> >     Fetcher* fetcher)
>> > {
>> >   Try<Docker*> create = Docker::create(flags.docker,
>> flags.docker_socket, true);
>> >   if (create.isError()) {
>> >     return Error("Failed to create docker: " + create.error());
>> >   }
>> >
>> >   Shared<Docker> docker(create.get());
>> >
>> >   if (flags.docker_mesos_image.isSome()) {
>> >     Try<Nothing> validateResult = docker->validateVersion(Version(1, 5,
>> 0));
>> >     if (validateResult.isError()) {
>> >       string message = "Docker with mesos images requires docker 1.5+";
>> >       message += validateResult.error();
>> >       return Error(message);
>> >     }
>> >   }
>> >
>> >   return new DockerContainerizer(flags, fetcher, docker);
>> > }
>> >
>> > The question now is how can we create an isolator to work together
>> > with the DockerContainerizer. Should we subclass the
>> > DockerContainerizer and create a FlockerContainerizer instead? Any
>> > other suggestions?
>> >
>> > Thanks in advance.
>> >
>> > Cheers,
>> >
>> > Frank and Phil
>>
>
>
>
> --
> Deshi Xiao
> Twitter: xds2000
> E-mail: xiaods(AT)gmail.com

Re: Mesos Flocker - Custom Isolator and Docker

Posted by tommy xiao <xi...@gmail.com>.
Tim,

interesting on the MesosContainerizer's design, what technology to support
it? runC solution?

2015-11-25 19:09 GMT+08:00 Timothy Chen <tn...@gmail.com>:

> Hi there,
>
> DockerContainerizer doesn't support isolators simply because we
> delegate all container creation to Docker via docker client, and
> therefore we don't have a way to run our isolators that's in
> mesos-slave from docker.
>
> We're working on unified containerizer that brings Docker images to
> Mesos Containerizer, so you can launch containers with docker images
> with it. There is a working initial code that's already in master that
> you can try out, and once you have the isolator you can then launch
> containers with docker images with your new isolator with
> MesosContainerizer.
>
> Tim
>
> On Wed, Nov 25, 2015 at 2:48 AM, Frank Scholten <fr...@frankscholten.nl>
> wrote:
> > Hi all,
> >
> > We (Frank Scholten and Phil Winder) are currently developing the Mesos
> > Flocker framework. As part of this framework we want to develop a
> > custom isolator module which interacts with the Flocker Control
> > Service.
> >
> > After creating a simple stub isolator and installing it on one of the
> > agents we noticed it gets picked up we run a regular task but it does
> > not get picked up when we run a Docker container.
> >
> > To us it seems that this is because isolators can only be used by the
> > MesosContainerizer. The MesosContainerizer configures isolation in its
> > create factory method while the DockerContainerizes does not:
> >
> > MesosContainerizer
> >
> > Try<MesosContainerizer*> MesosContainerizer::create(
> >     const Flags& flags,
> >     bool local,
> >     Fetcher* fetcher)
> > {
> >   string isolation;
> >
> >   if (flags.isolation == "process") {
> >     LOG(WARNING) << "The 'process' isolation flag is deprecated, "
> >                  << "please update your flags to"
> >                  << " '--isolation=posix/cpu,posix/mem'.";
> >
> >     isolation = "posix/cpu,posix/mem";
> >   } else if (flags.isolation == "cgroups") {
> >     LOG(WARNING) << "The 'cgroups' isolation flag is deprecated, "
> >                  << "please update your flags to"
> >                  << " '--isolation=cgroups/cpu,cgroups/mem'.";
> >
> >     isolation = "cgroups/cpu,cgroups/mem";
> >   } else {
> >     isolation = flags.isolation;
> >   }
> >
> > DockerContainerizer
> >
> > Try<DockerContainerizer*> DockerContainerizer::create(
> >     const Flags& flags,
> >     Fetcher* fetcher)
> > {
> >   Try<Docker*> create = Docker::create(flags.docker,
> flags.docker_socket, true);
> >   if (create.isError()) {
> >     return Error("Failed to create docker: " + create.error());
> >   }
> >
> >   Shared<Docker> docker(create.get());
> >
> >   if (flags.docker_mesos_image.isSome()) {
> >     Try<Nothing> validateResult = docker->validateVersion(Version(1, 5,
> 0));
> >     if (validateResult.isError()) {
> >       string message = "Docker with mesos images requires docker 1.5+";
> >       message += validateResult.error();
> >       return Error(message);
> >     }
> >   }
> >
> >   return new DockerContainerizer(flags, fetcher, docker);
> > }
> >
> > The question now is how can we create an isolator to work together
> > with the DockerContainerizer. Should we subclass the
> > DockerContainerizer and create a FlockerContainerizer instead? Any
> > other suggestions?
> >
> > Thanks in advance.
> >
> > Cheers,
> >
> > Frank and Phil
>



-- 
Deshi Xiao
Twitter: xds2000
E-mail: xiaods(AT)gmail.com

Re: Mesos Flocker - Custom Isolator and Docker

Posted by Timothy Chen <tn...@gmail.com>.
Hi there,

DockerContainerizer doesn't support isolators simply because we
delegate all container creation to Docker via docker client, and
therefore we don't have a way to run our isolators that's in
mesos-slave from docker.

We're working on unified containerizer that brings Docker images to
Mesos Containerizer, so you can launch containers with docker images
with it. There is a working initial code that's already in master that
you can try out, and once you have the isolator you can then launch
containers with docker images with your new isolator with
MesosContainerizer.

Tim

On Wed, Nov 25, 2015 at 2:48 AM, Frank Scholten <fr...@frankscholten.nl> wrote:
> Hi all,
>
> We (Frank Scholten and Phil Winder) are currently developing the Mesos
> Flocker framework. As part of this framework we want to develop a
> custom isolator module which interacts with the Flocker Control
> Service.
>
> After creating a simple stub isolator and installing it on one of the
> agents we noticed it gets picked up we run a regular task but it does
> not get picked up when we run a Docker container.
>
> To us it seems that this is because isolators can only be used by the
> MesosContainerizer. The MesosContainerizer configures isolation in its
> create factory method while the DockerContainerizes does not:
>
> MesosContainerizer
>
> Try<MesosContainerizer*> MesosContainerizer::create(
>     const Flags& flags,
>     bool local,
>     Fetcher* fetcher)
> {
>   string isolation;
>
>   if (flags.isolation == "process") {
>     LOG(WARNING) << "The 'process' isolation flag is deprecated, "
>                  << "please update your flags to"
>                  << " '--isolation=posix/cpu,posix/mem'.";
>
>     isolation = "posix/cpu,posix/mem";
>   } else if (flags.isolation == "cgroups") {
>     LOG(WARNING) << "The 'cgroups' isolation flag is deprecated, "
>                  << "please update your flags to"
>                  << " '--isolation=cgroups/cpu,cgroups/mem'.";
>
>     isolation = "cgroups/cpu,cgroups/mem";
>   } else {
>     isolation = flags.isolation;
>   }
>
> DockerContainerizer
>
> Try<DockerContainerizer*> DockerContainerizer::create(
>     const Flags& flags,
>     Fetcher* fetcher)
> {
>   Try<Docker*> create = Docker::create(flags.docker, flags.docker_socket, true);
>   if (create.isError()) {
>     return Error("Failed to create docker: " + create.error());
>   }
>
>   Shared<Docker> docker(create.get());
>
>   if (flags.docker_mesos_image.isSome()) {
>     Try<Nothing> validateResult = docker->validateVersion(Version(1, 5, 0));
>     if (validateResult.isError()) {
>       string message = "Docker with mesos images requires docker 1.5+";
>       message += validateResult.error();
>       return Error(message);
>     }
>   }
>
>   return new DockerContainerizer(flags, fetcher, docker);
> }
>
> The question now is how can we create an isolator to work together
> with the DockerContainerizer. Should we subclass the
> DockerContainerizer and create a FlockerContainerizer instead? Any
> other suggestions?
>
> Thanks in advance.
>
> Cheers,
>
> Frank and Phil