workdir.go 824 B

123456789101112131415161718192021
  1. package daemon
  2. // ContainerCreateWorkdir creates the working directory. This solves the
  3. // issue arising from https://github.com/docker/docker/issues/27545,
  4. // which was initially fixed by https://github.com/docker/docker/pull/27884. But that fix
  5. // was too expensive in terms of performance on Windows. Instead,
  6. // https://github.com/docker/docker/pull/28514 introduces this new functionality
  7. // where the builder calls into the backend here to create the working directory.
  8. func (daemon *Daemon) ContainerCreateWorkdir(cID string) error {
  9. container, err := daemon.GetContainer(cID)
  10. if err != nil {
  11. return err
  12. }
  13. err = daemon.Mount(container)
  14. if err != nil {
  15. return err
  16. }
  17. defer daemon.Unmount(container)
  18. rootUID, rootGID := daemon.GetRemappedUIDGID()
  19. return container.SetupWorkingDirectory(rootUID, rootGID)
  20. }