Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -30,7 +30,6 @@ import ( |
| 30 | 30 |
"github.com/docker/docker/image" |
| 31 | 31 |
libcontainerdtypes "github.com/docker/docker/libcontainerd/types" |
| 32 | 32 |
"github.com/docker/docker/oci" |
| 33 |
- "github.com/docker/docker/pkg/idtools" |
|
| 34 | 33 |
"github.com/docker/docker/restartmanager" |
| 35 | 34 |
"github.com/docker/docker/volume" |
| 36 | 35 |
volumemounts "github.com/docker/docker/volume/mounts" |
| ... | ... |
@@ -321,7 +320,7 @@ func (container *Container) CommitInMemory(store *ViewDB) error {
|
| 321 | 321 |
} |
| 322 | 322 |
|
| 323 | 323 |
// SetupWorkingDirectory sets up the container's working directory as set in container.Config.WorkingDir |
| 324 |
-func (container *Container) SetupWorkingDirectory(rootIdentity idtools.Identity) error {
|
|
| 324 |
+func (container *Container) SetupWorkingDirectory(uid int, gid int) error {
|
|
| 325 | 325 |
if container.Config.WorkingDir == "" {
|
| 326 | 326 |
return nil |
| 327 | 327 |
} |
| ... | ... |
@@ -332,7 +331,7 @@ func (container *Container) SetupWorkingDirectory(rootIdentity idtools.Identity) |
| 332 | 332 |
return err |
| 333 | 333 |
} |
| 334 | 334 |
|
| 335 |
- if err := user.MkdirAllAndChown(pth, 0o755, rootIdentity.UID, rootIdentity.GID, user.WithOnlyNew); err != nil {
|
|
| 335 |
+ if err := user.MkdirAllAndChown(pth, 0o755, uid, gid, user.WithOnlyNew); err != nil {
|
|
| 336 | 336 |
pthInfo, err2 := os.Stat(pth) |
| 337 | 337 |
if err2 == nil && pthInfo != nil && !pthInfo.IsDir() {
|
| 338 | 338 |
return errors.Errorf("Cannot mkdir: %s is not a directory", container.Config.WorkingDir)
|
| ... | ... |
@@ -28,8 +28,7 @@ func (daemon *Daemon) createContainerOSSpecificSettings(ctx context.Context, con |
| 28 | 28 |
} |
| 29 | 29 |
defer daemon.Unmount(container) |
| 30 | 30 |
|
| 31 |
- uid, gid := daemon.idMapping.RootPair() |
|
| 32 |
- if err := container.SetupWorkingDirectory(idtools.Identity{UID: uid, GID: gid}); err != nil {
|
|
| 31 |
+ if err := container.SetupWorkingDirectory(daemon.idMapping.RootPair()); err != nil {
|
|
| 33 | 32 |
return err |
| 34 | 33 |
} |
| 35 | 34 |
|
| ... | ... |
@@ -21,7 +21,6 @@ import ( |
| 21 | 21 |
"github.com/docker/docker/internal/rootless/specconv" |
| 22 | 22 |
"github.com/docker/docker/oci" |
| 23 | 23 |
"github.com/docker/docker/oci/caps" |
| 24 |
- "github.com/docker/docker/pkg/idtools" |
|
| 25 | 24 |
volumemounts "github.com/docker/docker/volume/mounts" |
| 26 | 25 |
"github.com/moby/sys/mount" |
| 27 | 26 |
"github.com/moby/sys/mountinfo" |
| ... | ... |
@@ -712,8 +711,7 @@ func withCommonOptions(daemon *Daemon, daemonCfg *dconfig.Config, c *container.C |
| 712 | 712 |
Path: c.BaseFS, |
| 713 | 713 |
Readonly: c.HostConfig.ReadonlyRootfs, |
| 714 | 714 |
} |
| 715 |
- uid, gid := daemon.idMapping.RootPair() |
|
| 716 |
- if err := c.SetupWorkingDirectory(idtools.Identity{UID: uid, GID: gid}); err != nil {
|
|
| 715 |
+ if err := c.SetupWorkingDirectory(daemon.idMapping.RootPair()); err != nil {
|
|
| 717 | 716 |
return err |
| 718 | 717 |
} |
| 719 | 718 |
cwd := c.Config.WorkingDir |
| ... | ... |
@@ -1,7 +1,5 @@ |
| 1 | 1 |
package daemon // import "github.com/docker/docker/daemon" |
| 2 | 2 |
|
| 3 |
-import "github.com/docker/docker/pkg/idtools" |
|
| 4 |
- |
|
| 5 | 3 |
// ContainerCreateWorkdir creates the working directory. This solves the |
| 6 | 4 |
// issue arising from https://github.com/docker/docker/issues/27545, |
| 7 | 5 |
// which was initially fixed by https://github.com/docker/docker/pull/27884. But that fix |
| ... | ... |
@@ -18,6 +16,5 @@ func (daemon *Daemon) ContainerCreateWorkdir(cID string) error {
|
| 18 | 18 |
return err |
| 19 | 19 |
} |
| 20 | 20 |
defer daemon.Unmount(container) |
| 21 |
- uid, gid := daemon.idMapping.RootPair() |
|
| 22 |
- return container.SetupWorkingDirectory(idtools.Identity{UID: uid, GID: gid})
|
|
| 21 |
+ return container.SetupWorkingDirectory(daemon.idMapping.RootPair()) |
|
| 23 | 22 |
} |