func (i *Inspector) FinishMonitoring() {
	cmdResponse, err := ipc.SendContainerCmd(&messages.StopMonitor{})
	utils.WarnOn(err)
	_ = cmdResponse

	log.Debugf("'stop' response => '%v'\n", cmdResponse)
	log.Info("docker-slim: waiting for the container finish its work...")

	//for now there's only one event ("done")
	//getEvt() should timeout in two minutes (todo: pick a good timeout)
	evt, err := ipc.GetContainerEvt()
	utils.WarnOn(err)
	_ = evt
	log.Debugf("docker-slim: sensor event => '%v'\n", evt)
}
func (i *Inspector) RunContainer() error {
	artifactsPath := filepath.Join(i.LocalVolumePath, "artifacts")
	sensorPath := filepath.Join(utils.ExeDir(), "docker-slim-sensor")

	artifactsMountInfo := fmt.Sprintf("%s:/opt/dockerslim/artifacts", artifactsPath)
	sensorMountInfo := fmt.Sprintf("%s:/opt/dockerslim/bin/sensor:ro", sensorPath)

	var volumeBinds []string
	for _, volumeMount := range i.VolumeMounts {
		mountInfo := fmt.Sprintf("%s:%s:%s", volumeMount.Source, volumeMount.Destination, volumeMount.Options)
		volumeBinds = append(volumeBinds, mountInfo)
	}

	volumeBinds = append(volumeBinds, artifactsMountInfo)
	volumeBinds = append(volumeBinds, sensorMountInfo)

	var containerCmd []string
	if i.DoDebug {
		containerCmd = append(containerCmd, "-d")
	}

	i.ContainerName = fmt.Sprintf("dockerslimk_%v_%v", os.Getpid(), time.Now().UTC().Format("20060102150405"))

	containerOptions := dockerapi.CreateContainerOptions{
		Name: i.ContainerName,
		Config: &dockerapi.Config{
			Image: i.ImageInspector.ImageRef,
			ExposedPorts: map[dockerapi.Port]struct{}{
				i.CmdPort: struct{}{},
				i.EvtPort: struct{}{},
			},
			Entrypoint: []string{"/opt/dockerslim/bin/sensor"},
			Cmd:        containerCmd,
			Env:        i.Overrides.Env,
			Labels:     map[string]string{"type": "dockerslim"},
		},
		HostConfig: &dockerapi.HostConfig{
			Binds:           volumeBinds,
			PublishAllPorts: true,
			CapAdd:          []string{"SYS_ADMIN"},
			Privileged:      true,
		},
	}

	containerInfo, err := i.ApiClient.CreateContainer(containerOptions)
	if err != nil {
		return err
	}

	i.ContainerID = containerInfo.ID
	log.Infoln("docker-slim: created container =>", i.ContainerID)

	if err := i.ApiClient.StartContainer(i.ContainerID, nil); err != nil {
		return err
	}

	if i.ContainerInfo, err = i.ApiClient.InspectContainer(i.ContainerID); err != nil {
		return err
	}

	utils.FailWhen(i.ContainerInfo.NetworkSettings == nil, "docker-slim: error => no network info")
	log.Debugf("container NetworkSettings.Ports => %#v\n", i.ContainerInfo.NetworkSettings.Ports)

	if err = i.initContainerChannels(); err != nil {
		return err
	}

	cmd := &messages.StartMonitor{
		AppName: i.FatContainerCmd[0],
	}

	if len(i.FatContainerCmd) > 1 {
		cmd.AppArgs = i.FatContainerCmd[1:]
	}

	if len(i.ExcludePaths) > 0 {
		cmd.Excludes = pathMapKeys(i.ExcludePaths)
	}

	if len(i.IncludePaths) > 0 {
		cmd.Includes = pathMapKeys(i.IncludePaths)
	}

	_, err = ipc.SendContainerCmd(cmd)
	return err
}