lib/plugins/aws/invokeLocal/index.js/AwsInvokeLocal/invokeLocalDocker
class AwsInvokeLocal:  invokeLocalDocker() {
    const handler = this.options.functionObj.handler;

    return this.serverless.pluginManager.spawn('package').then(() =>
      BbPromise.all([
        this.checkDockerDaemonStatus(),
        this.checkDockerImage().then(exists => (exists ? {} : this.pullDockerImage())),
        this.getLayerPaths().then(layerPaths => this.buildDockerImage(layerPaths)),
        this.extractArtifact(),
      ])
        .then((results) => new BbPromise((resolve, reject) => {
          const imageName = results[2];
          const artifactPath = results[3];
          const dockerArgsFromOptions = this.getDockerArgsFromOptions();
          const dockerArgs = _.concat([
            'run', '--rm', '-v', `${artifactPath}:/var/task`,
          ], dockerArgsFromOptions, [
            imageName, handler, JSON.stringify(this.options.data),
          ]);
          const docker = spawn('docker', dockerArgs);
          docker.stdout.on('data', (buf) => this.serverless.cli.consoleLog(buf.toString()));
          docker.stderr.on('data', (buf) => this.serverless.cli.consoleLog(buf.toString()));
          docker.on('exit', error => (error ? reject(error) : resolve(imageName)));
        }))
    );
  }