parent
700966fc27
commit
5139b853fa
|
@ -31,6 +31,7 @@ type Config struct {
|
||||||
Pull bool
|
Pull bool
|
||||||
RunCommand []string `mapstructure:"run_command"`
|
RunCommand []string `mapstructure:"run_command"`
|
||||||
Volumes map[string]string
|
Volumes map[string]string
|
||||||
|
Privileged bool `mapstructure:"privileged"`
|
||||||
|
|
||||||
// This is used to login to dockerhub to pull a private base container. For
|
// This is used to login to dockerhub to pull a private base container. For
|
||||||
// pushing to dockerhub, see the docker post-processors
|
// pushing to dockerhub, see the docker post-processors
|
||||||
|
|
|
@ -64,6 +64,7 @@ type ContainerConfig struct {
|
||||||
Image string
|
Image string
|
||||||
RunCommand []string
|
RunCommand []string
|
||||||
Volumes map[string]string
|
Volumes map[string]string
|
||||||
|
Privileged bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the template that is used for the RunCommand in the ContainerConfig.
|
// This is the template that is used for the RunCommand in the ContainerConfig.
|
||||||
|
|
|
@ -210,6 +210,9 @@ func (d *DockerDriver) StartContainer(config *ContainerConfig) (string, error) {
|
||||||
|
|
||||||
// Args that we're going to pass to Docker
|
// Args that we're going to pass to Docker
|
||||||
args := []string{"run"}
|
args := []string{"run"}
|
||||||
|
if config.Privileged {
|
||||||
|
args = append(args, "--privileged")
|
||||||
|
}
|
||||||
for host, guest := range config.Volumes {
|
for host, guest := range config.Volumes {
|
||||||
args = append(args, "-v", fmt.Sprintf("%s:%s", host, guest))
|
args = append(args, "-v", fmt.Sprintf("%s:%s", host, guest))
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
Image: config.Image,
|
Image: config.Image,
|
||||||
RunCommand: config.RunCommand,
|
RunCommand: config.RunCommand,
|
||||||
Volumes: make(map[string]string),
|
Volumes: make(map[string]string),
|
||||||
|
Privileged: config.Privileged,
|
||||||
}
|
}
|
||||||
|
|
||||||
for host, container := range config.Volumes {
|
for host, container := range config.Volumes {
|
||||||
|
|
Loading…
Reference in New Issue