workdir.go 831 B

1234567891011121314151617181920
  1. package daemon // import "github.com/docker/docker/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. return container.SetupWorkingDirectory(daemon.idMapping.RootPair())
  19. }