<commit_before>package daemon

import (
	"fmt"

	"github.com/docker/docker/runconfig"
)

func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConfig) error {
	container, err := daemon.Get(name)
	if err != nil {
		return err
	}

	if container.IsPaused() {
		return fmt.Errorf("Cannot start a paused container, try unpause instead.")
	}

	if container.IsRunning() {
		return fmt.Errorf("Container already started")
	}

	if _, err = daemon.verifyContainerSettings(hostConfig, nil); err != nil {
		return err
	}

	// This is kept for backward compatibility - hostconfig should be passed when
	// creating a container, not during start.
	if hostConfig != nil {
		if err := daemon.setHostConfig(container, hostConfig); err != nil {
			return err
		}
	}

	if err := container.Start(); err != nil {
		return fmt.Errorf("Cannot start container %s: %s", name, err)
	}

	return nil
}<commit_msg>Windows: hostconfig on start<commit_after>package daemon

import (
	"fmt"
	"runtime"

	"github.com/docker/docker/runconfig"
)

func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConfig) error {
	container, err := daemon.Get(name)
	if err != nil {
		return err
	}

	if container.IsPaused() {
		return fmt.Errorf("Cannot start a paused container, try unpause instead.")
	}

	if container.IsRunning() {
		return fmt.Errorf("Container already started")
	}

	if _, err = daemon.verifyContainerSettings(hostConfig, nil); err != nil {
		return err
	}

	// Windows does not have the backwards compatibilty issue here.
	if runtime.GOOS != "windows" {
		// This is kept for backward compatibility - hostconfig should be passed when
		// creating a container, not during start.
		if hostConfig != nil {
			if err := daemon.setHostConfig(container, hostConfig); err != nil {
				return err
			}
		}
	} else {
		if hostConfig != nil {
			return fmt.Errorf("Supplying a hostconfig on start is not supported. It should be supplied on create")
		}
	}

	if err := container.Start(); err != nil {
		return fmt.Errorf("Cannot start container %s: %s", name, err)
	}

	return nil
}
{'fraction_non_alphanumeric': 0.11520076481835564, 'fraction_numerical': 0.0, 'mean_word_length': 3.778538812785388, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '603632', 'n_tokens_mistral': 693, 'n_tokens_neox': 642, 'n_words': 213}