'Creates a task definition from a container image that can be run
in a cluster.
:param name: The name of the new container
:type  name: ``str``
:param image: The container image to deploy
:type  image: :class:`libcloud.container.base.ContainerImage`
:param cluster: The cluster to deploy to, None is default
:type  cluster: :class:`libcloud.container.base.ContainerCluster`
:param parameters: Container Image parameters
:type  parameters: ``str``
:param start: Start the container on deployment
:type  start: ``bool``
:rtype: :class:`libcloud.container.base.Container`'

def deploy_container(self, name, image, cluster=None, parameters=None, start=True, ex_cpu=10, ex_memory=500, ex_container_port=None, ex_host_port=None):

    data = {}
    if ((ex_container_port is None) and (ex_host_port is None)):
        port_maps = []
    else:
        port_maps = [{'containerPort': ex_container_port, 'hostPort': ex_host_port}]
    data['containerDefinitions'] = [{'mountPoints': [], 'name': name, 'image': image.name, 'cpu': ex_cpu, 'environment': [], 'memory': ex_memory, 'portMappings': port_maps, 'essential': True, 'volumesFrom': []}]
    data['family'] = name
    response = self.connection.request(ROOT, method='POST', data=json.dumps(data), headers=self._get_headers('RegisterTaskDefinition')).object
    if start:
        return self.ex_start_task(response['taskDefinition']['taskDefinitionArn'])[0]
    else:
        return Container(id=None, name=name, image=image, state=ContainerState.RUNNING, ip_addresses=[], extra={'taskDefinitionArn': response['taskDefinition']['taskDefinitionArn']}, driver=self.connection.driver)
