Hey John,

When you launch a task you do so by filling a `TaskInfo` protobuf message with 
all the information necessary to run your task. Among the fields of this 
`TaskInfo` message there is one called `container` of type `ContainerInfo` 
which in turn has a field called `docker` of type `DockerInfo`. The latter is 
the one with the field `force_pull_image` of type `bool`.

An example of how to do so would look like in C++ using libmesos:

```
TaskInfo task;
task.set_name(“Test task”);
task.mutable_task_id()->set_value(“Test task 1”);
task.mutable_slave_id()->CopyFrom(offers.get()[0].slave_id());
task.mutable_resources()->CopyFrom(offers.get()[0].resources());

CommandInfo command;
command.set_value(“while true; do echo ‘Hello World’; sleep 2; done");
task.mutable_command()->CopyFrom(command);

ContainerInfo::DockerInfo docker;
docker.set_image(“images/test-image”);
docker.set_force_pull_image(true);

ContainerInfo container;
container.set_type(ContainerInfo::DOCKER);
container.mutable_docker()->CopyFrom(docker);
task.mutable_container()->CopyFrom(container);

driver.launchTasks(offers.get()[0].id(), {task});
```

> On 27 Aug 2016, at 06:10, John Wetherill <[email protected]> wrote:
> 
> According to this docker-containerizer doc 
> <http://mesos.apache.org/documentation/latest/docker-containerizer/>:
> 
> "The containerizer also supports optional force pulling of the image. It is 
> set disabled as default, so the docker image will only be updated again if 
> it’s not available on the host. To enable force pulling an image, 
> force_pull_image has to be set as true."
> 
> I haven't been able to figure out how to enable force_pull_image for 
> mesos-slave. There are hints here 
> <https://issues.apache.org/jira/browse/MESOS-1886> but still not clear to me.
> 
> Any additional hints appreciated.
> 
> 

Reply via email to