Skip to content
This repository has been archived by the owner on Mar 30, 2018. It is now read-only.

Commit

Permalink
support docker api 1.24+ (#2263)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeasy authored and srderson committed Jul 26, 2016
1 parent 08c2d2a commit 346f9fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/container/dockercontroller/dockercontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func getDockerHostConfig() *docker.HostConfig {

func (vm *DockerVM) createContainer(ctxt context.Context, client *docker.Client, imageID string, containerID string, args []string, env []string, attachstdin bool, attachstdout bool) error {
config := docker.Config{Cmd: args, Image: imageID, Env: env, AttachStdin: attachstdin, AttachStdout: attachstdout}
copts := docker.CreateContainerOptions{Name: containerID, Config: &config}
copts := docker.CreateContainerOptions{Name: containerID, Config: &config, HostConfig: getDockerHostConfig()}
dockerLogger.Debugf("Create container: %s", containerID)
_, err := client.CreateContainer(copts)
if err != nil {
Expand Down Expand Up @@ -191,6 +191,9 @@ func (vm *DockerVM) Start(ctxt context.Context, ccid ccintf.CCID, args []string,
}
}

// Baohua: getDockerHostConfig() will be ignored when communicating with docker API 1.24+.
// I keep it here for a short-term compatibility.
// See https://goo.gl/ZvtkKm for more details.
err = client.StartContainer(containerID, getDockerHostConfig())
if err != nil {
dockerLogger.Errorf("start-could not start container %s", err)
Expand Down

0 comments on commit 346f9fb

Please sign in to comment.