Skip to content

Commit 4d47da6

Browse files
gloursndeloof
authored andcommitted
do not pass user id on Windows system as engine is not able to handel it
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
1 parent 8f91793 commit 4d47da6

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

pkg/bridge/convert.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"os"
2424
"os/user"
2525
"path/filepath"
26+
"runtime"
2627
"strconv"
2728

2829
"github.com/compose-spec/compose-go/v2/types"
@@ -112,15 +113,20 @@ func convert(ctx context.Context, dockerCli command.Cli, model map[string]any, o
112113
return err
113114
}
114115

115-
usr, err := user.Current()
116-
if err != nil {
117-
return err
118-
}
119-
created, err := dockerCli.Client().ContainerCreate(ctx, &container.Config{
116+
containerConfig := &container.Config{
120117
Image: transformation,
121118
Env: []string{"LICENSE_AGREEMENT=true"},
122-
User: usr.Uid,
123-
}, &container.HostConfig{
119+
}
120+
// On POSIX systems, this is a decimal number representing the uid.
121+
// On Windows, this is a security identifier (SID) in a string format and the engine isn't able to manage it
122+
if runtime.GOOS != "windows" {
123+
usr, err := user.Current()
124+
if err != nil {
125+
return err
126+
}
127+
containerConfig.User = usr.Uid
128+
}
129+
created, err := dockerCli.Client().ContainerCreate(ctx, containerConfig, &container.HostConfig{
124130
AutoRemove: true,
125131
Binds: binds,
126132
}, &network.NetworkingConfig{}, nil, "")

0 commit comments

Comments
 (0)