get.porter.sh/porter@v1.3.0/pkg/cnab/provider/driver_windows.go (about)

     1  package cnabprovider
     2  
     3  import (
     4  	"github.com/docker/docker/api/types/container"
     5  	"github.com/docker/docker/api/types/mount"
     6  )
     7  
     8  func (r *Runtime) mountDockerSocket(cfg *container.Config, hostCfg *container.HostConfig) error {
     9  	// Equivalent of using: -v /var/run/docker.sock:/var/run/docker.sock
    10  	// Required for DooD, or "Docker-out-of-Docker"
    11  	dockerSockMount := mount.Mount{
    12  		Source:   "/var/run/docker.sock",
    13  		Target:   "/var/run/docker.sock",
    14  		Type:     "bind",
    15  		ReadOnly: false,
    16  	}
    17  	hostCfg.Mounts = append(hostCfg.Mounts, dockerSockMount)
    18  	return nil
    19  }
    20  
    21  func (r *Runtime) addVolumeMountToHostConfig(hostConfig *container.HostConfig, source string, target string, readOnly bool) error {
    22  	mount := mount.Mount{
    23  		Source:   source,
    24  		Target:   target,
    25  		Type:     "bind",
    26  		ReadOnly: readOnly,
    27  	}
    28  	hostConfig.Mounts = append(hostConfig.Mounts, mount)
    29  	return nil
    30  }