def createContainer(self, client):
    command = self.getCommand()
    if not command:
      fail('No command defined in either gantry config or docker image for component ' +
           self.getName(), component=self)

    self.logger.debug('Starting container for component %s with command %s', self.getName(),
                      command)
                      
    container = client.create_container(self.config.getFullImage(), command,
                                        user=self.config.getUser(),
                                        volumes=self.config.getVolumes(),
                                        ports=[str(p) for p in self.config.getContainerPorts()],
                                        environment=self.calculateEnvForComponent())

    return container
Creates a docker container for this component and returns it.
dataset/ETHPy150Open DevTable/gantryd/runtime/component.py/Component.createContainer