Skip to content

Commit

Permalink
fix: replicate docker container permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
theobori committed Oct 25, 2023
1 parent 7134d0d commit 85deeb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
11 changes: 3 additions & 8 deletions internal/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package docker

import (
"context"
"io/ioutil"
"io"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
Expand Down Expand Up @@ -105,17 +105,12 @@ func ExecContainer(
cli *client.Client,
command *strslice.StrSlice,
mounts *[]mount.Mount,
user string,
) error {
config := container.Config{
Cmd: *command,
Image: DockerImage,
}

if user != "" {
config.User = user
}

resp, err := cli.ContainerCreate(
ctx,
&config,
Expand Down Expand Up @@ -153,7 +148,7 @@ func DockerVolumeCopy(ctx context.Context, cli *client.Client, vSrc string, vDes
Source: vDest,
Target: "/dest",
},
}, "",
},
)
}

Expand Down Expand Up @@ -182,7 +177,7 @@ func DockerTryPull(ctx context.Context, cli *client.Client, id string) (bool, er

defer out.Close()

if _, err := ioutil.ReadAll(out); err != nil {
if _, err := io.ReadAll(out); err != nil {
return false, err
}

Expand Down
6 changes: 2 additions & 4 deletions internal/point/tarball.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"context"
"fmt"
"io"
"os"
"path/filepath"
"strings"

Expand Down Expand Up @@ -134,7 +133,7 @@ func (t *TarballPoint) From(vSrc *[]string) error {
Source: tmpVolumeName,
Target: "/dest",
},
}, "",
},
)

if err != nil {
Expand Down Expand Up @@ -169,7 +168,6 @@ func (t *TarballPoint) From(vSrc *[]string) error {
Target: "/dest",
},
},
fmt.Sprintf("%d:%d", os.Getuid(), os.Getegid()),
)

if err != nil {
Expand Down Expand Up @@ -219,7 +217,7 @@ func (t *TarballPoint) To(vDest *[]string) error {
Source: volume,
Target: "/dest",
},
}, "",
},
)

if err != nil {
Expand Down

0 comments on commit 85deeb5

Please sign in to comment.