Skip to content

Commit

Permalink
use --mount instead of --volume for docker bind mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
loderunner committed Jul 19, 2023
1 parent 2b414df commit 431ba76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ func writeStringToTempFile(tempDir, data string) (string, error) {
func generateDockerCommand(tempDir, configPath, image, pwd string, job string, dockerSocketPath string, arguments ...string) []string {
configPathInsideContainer := fmt.Sprintf("%s/local_build_config.yml", tempDir)
core := []string{"docker", "run", "--rm",
"--volume", fmt.Sprintf("%s:/var/run/docker.sock", dockerSocketPath),
"--volume", fmt.Sprintf("%s:%s", configPath, configPathInsideContainer),
"--volume", fmt.Sprintf("%s:%s", pwd, pwd),
"--volume", fmt.Sprintf("%s:/root/.circleci", settings.SettingsPath()),
"--mount", fmt.Sprintf("type=bind,src=%s,dst=/var/run/docker.sock", dockerSocketPath),
"--mount", fmt.Sprintf("type=bind,src=%s,dst=%s", configPath, configPathInsideContainer),
"--mount", fmt.Sprintf("type=bind,src=%s,dst=%s", pwd, pwd),
"--mount", fmt.Sprintf("type=bind,src=%s,dst=/root/.circleci", settings.SettingsPath()),
"--workdir", pwd,
image, "circleci", "build", "--config", configPathInsideContainer, "--job", job}
return append(core, arguments...)
Expand Down
8 changes: 4 additions & 4 deletions local/local_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ var _ = Describe("build", func() {
"docker",
"run",
"--rm",
"--volume", "/var/run/docker.sock:/var/run/docker.sock",
"--volume", "/config/path:/tempdir/local_build_config.yml",
"--volume", "/current/directory:/current/directory",
"--volume", home+"/.circleci:/root/.circleci",
"--mount", "type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock",
"--mount", "type=bind,src=/config/path,dst=/tempdir/local_build_config.yml",
"--mount", "type=bind,src=/current/directory,dst=/current/directory",
"--mount", "type=bind,src="+home+"/.circleci,dst=/root/.circleci",
"--workdir", "/current/directory",
"docker-image-name", "circleci", "build",
"--config", "/tempdir/local_build_config.yml",
Expand Down

0 comments on commit 431ba76

Please sign in to comment.