Ignore my comment about docker run not returning. That is incorrect. Thanks,
Andy. -- Andy Grove VP Engineering CodeFutures Corporation On Mon, Sep 29, 2014 at 5:59 PM, Andy Grove <[email protected]> wrote: > Hi Vinod, > > Thanks for the quick response but the image is already on the slave and I > see the container being launched almost immediately when my framework > starts (within 1-2 seconds). If I keep running docker ps, this is the last > output I see before the container is killed: > > $ docker ps > CONTAINER ID IMAGE COMMAND > CREATED STATUS PORTS NAMES > 45f992c2781f codefutures/dbshards_zookeeper:latest "/bin/sh -c > '/opt/zo 59 seconds ago Up 58 seconds > > I am using mesos 0.20.1 and docker 1.2.0 on Ubuntu 14.04. > > So the container is running fine. It is a long running service i.e. the > docker run command will never return. Should I be providing some option so > that the docker executor passed the -d flag to the docker run command? I > guess I should start looking through the mesos source so I can see how this > works. > > Thanks, > > Andy. > > -- > Andy Grove > VP Engineering > CodeFutures Corporation > > > > On Mon, Sep 29, 2014 at 5:49 PM, Vinod Kone <[email protected]> wrote: > >> Trying increasing the executor registration timeout on the slave >> (--executor_registration_timeout) to give docker more time to do a pull of >> the image. >> >> On Mon, Sep 29, 2014 at 4:41 PM, Andy Grove <[email protected]> >> wrote: >> >>> Hi, >>> >>> I've working on a prototype Mesos framework to launch docker containers. >>> I'm getting as far as seeing my container start up but after one minute if >>> gets killed due to: >>> >>> Terminating executor default of framework >>> 20140929-155916-16777343-5050-2708-0004 because it did not register within >>> 1mins >>> >>> Here is the code I am using in my scheduler, which was based on one of >>> the examples: >>> >>> @Override >>> public void resourceOffers(SchedulerDriver schedulerDriver, >>> List<Protos.Offer> offers) { >>> logger.info("resourceOffers() with {} offers", offers.size()); >>> >>> for (Protos.Offer offer : offers) { >>> >>> List<Protos.TaskInfo> tasks = new ArrayList<Protos.TaskInfo>(); >>> if (launchedTasks < totalTasks) { >>> Protos.TaskID taskId = Protos.TaskID.newBuilder() >>> .setValue(Integer.toString(launchedTasks++)).build(); >>> >>> logger.info("Launching task " + taskId.getValue()); >>> >>> // docker image info >>> Protos.ContainerInfo.DockerInfo.Builder dockerInfoBuilder = >>> Protos.ContainerInfo.DockerInfo.newBuilder(); >>> dockerInfoBuilder.setImage("codefutures/dbshards_zookeeper"); >>> >>> // container info >>> Protos.ContainerInfo.Builder containerInfoBuilder = >>> Protos.ContainerInfo.newBuilder(); >>> containerInfoBuilder.setType(Protos.ContainerInfo.Type.DOCKER); >>> containerInfoBuilder.setDocker(dockerInfoBuilder.build()); >>> >>> // create executor for the container >>> Protos.ExecutorInfo executor = Protos.ExecutorInfo.newBuilder() >>> >>> .setExecutorId(Protos.ExecutorID.newBuilder().setValue("default")) >>> .setCommand(Protos.CommandInfo.newBuilder().setShell(false)) >>> .setContainer(containerInfoBuilder) >>> .setName("Test Executor (Docker)") >>> .setSource("docker_test") >>> .build(); >>> >>> // create task to run >>> Protos.TaskInfo task = Protos.TaskInfo.newBuilder() >>> .setName("task " + taskId.getValue()) >>> .setTaskId(taskId) >>> .setSlaveId(offer.getSlaveId()) >>> .addResources(Protos.Resource.newBuilder() >>> .setName("cpus") >>> .setType(Protos.Value.Type.SCALAR) >>> .setScalar(Protos.Value.Scalar.newBuilder().setValue(1))) >>> .addResources(Protos.Resource.newBuilder() >>> .setName("mem") >>> .setType(Protos.Value.Type.SCALAR) >>> >>> .setScalar(Protos.Value.Scalar.newBuilder().setValue(128))) >>> .setExecutor(Protos.ExecutorInfo.newBuilder(executor)) >>> .build(); >>> >>> tasks.add(task); >>> } >>> Protos.Filters filters = >>> Protos.Filters.newBuilder().setRefuseSeconds(1).build(); >>> >>> schedulerDriver.launchTasks(offer.getId(), tasks, filters); >>> } >>> >>> } >>> >>> Am I missing some steps with this approach? >>> >>> Thanks, >>> >>> Andy. >>> >>> -- >>> Andy Grove >>> VP Engineering >>> CodeFutures Corporation >>> >>> >>> >> >

