builder/docker: default container dir to "c:/packer-files" on windows

This commit is contained in:
Adrien Delorme 2019-05-22 16:43:29 +02:00
parent f031c95142
commit 2da36b7374
2 changed files with 8 additions and 3 deletions

View File

@ -3,6 +3,7 @@ package docker
import ( import (
"fmt" "fmt"
"os" "os"
"runtime"
"github.com/hashicorp/packer/common" "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/communicator"
@ -124,7 +125,11 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
} }
if c.ContainerDir == "" { if c.ContainerDir == "" {
c.ContainerDir = "/packer-files" if runtime.GOOS == "windows" {
c.ContainerDir = "c:/packer-files"
} else {
c.ContainerDir = "/packer-files"
}
} }
if c.EcrLogin && c.LoginServer == "" { if c.EcrLogin && c.LoginServer == "" {

View File

@ -232,8 +232,8 @@ You must specify (only) one of `commit`, `discard`, or `export_path`.
- `container_dir` (string) - The directory inside container to mount temp - `container_dir` (string) - The directory inside container to mount temp
directory from host server for work [file directory from host server for work [file
provisioner](/docs/provisioners/file.html). By default this is set to provisioner](/docs/provisioners/file.html). This defaults to
`/packer-files`. `c:/packer-files` on windows and `/packer-files` on other systems.
- `fix_upload_owner` (boolean) - If true, files uploaded to the container - `fix_upload_owner` (boolean) - If true, files uploaded to the container
will be owned by the user the container is running as. If false, the owner will be owned by the user the container is running as. If false, the owner