code: func createCompose(dir string, cli *client.Client, opts composeOptions) (string, error) {
  	if dir == "" {
  		var err error
  		dir, err = ioutil.TempDir("", "integration-cli-on-swarm-")
  		if err != nil {
  			return "", err
  		}
  	}
  	resolved := composeTemplateOptions{}
  	resolved.composeOptions = opts
  	workerImageInspect, _, err := cli.ImageInspectWithRaw(context.Background(), defaultWorkerImageName)
  	if err != nil {
  		return "", err
  	}
  	if len(workerImageInspect.RepoDigests) > 0 {
  		resolved.WorkerImageDigest = workerImageInspect.RepoDigests[0]
  	} else {
  		// fall back for non-pushed image
  		resolved.WorkerImageDigest = workerImageInspect.ID
  	}
  	info, err := cli.Info(context.Background())
  	if err != nil {
  		return "", err
  	}
  	resolved.SelfNodeID = info.Swarm.NodeID
  	resolved.EnvDockerGraphDriver = os.Getenv("DOCKER_GRAPHDRIVER")
  	resolved.EnvDockerExperimental = os.Getenv("DOCKER_EXPERIMENTAL")
  	composeFilePath := filepath.Join(dir, "docker-compose.yml")
  	tmpl, err := template.New("").Parse(composeTemplate)
  	if err != nil {
  		return "", err
  	}
  	f, err := os.Create(composeFilePath)
  	if err != nil {
  		return "", err
  	}
  	defer f.Close()
  	if err = tmpl.Execute(f, resolved); err != nil {
  		return "", err
  	}
  	return composeFilePath, nil
  }
docs: // createCompose creates "dir/docker-compose.yml".
  // If dir is empty, TempDir() is used.