When you start docker, you call api/client/start.go , which calls:
cli.client.ContainerStart(containerID)
This calls engine-api/client/container_start.go :
cli.post("/containers/"+containerID+"/start", nil, nil, nil)
The daemon daemon process that the API calls in daemon/start.go :
container.StartMonitor(daemon, container.HostConfig.RestartPolicy)
The container monitor starts the container in container/monitor.go :
m.supervisor.Run(m.container, pipes, m.callback)
By default, the docker daemon is the supervisor here in daemon / daemon.go :
daemon.execDriver.Run(c.Command, pipes, hooks)
And execDriver creates a command line in daemon/execdriver/windows/exec.go :
createProcessParms.CommandLine, err = createCommandLine(processConfig, false)
This uses processConfig.Entrypoint and processConfig.Arguments in daemon/execdriver/windows/commandlinebuilder.go :
// Build the command line of the process commandLine = processConfig.Entrypoint logrus.Debugf("Entrypoint: %s", processConfig.Entrypoint) for _, arg := range processConfig.Arguments { logrus.Debugf("appending %s", arg) if !alreadyEscaped { arg = syscall.EscapeArg(arg) } commandLine += " " + arg }
Those processConfig.Arguments are populated in daemon/container_operations_windows.go :
processConfig := execdriver.ProcessConfig{ CommonProcessConfig: execdriver.CommonProcessConfig{ Entrypoint: c.Path, Arguments: c.Args, Tty: c.Config.Tty, },
moreover, c.Args is the argument of the container (runtile or CMD parameters)
So yes, the CMD commands execute after docker start .