diff --git a/components/supervisor/pkg/supervisor/supervisor.go b/components/supervisor/pkg/supervisor/supervisor.go index 0ed477bd26997f..7787a74b53a9dc 100644 --- a/components/supervisor/pkg/supervisor/supervisor.go +++ b/components/supervisor/pkg/supervisor/supervisor.go @@ -286,7 +286,7 @@ func Run(options ...RunOption) { // - in headless task we can not use reaper, because it breaks headlessTaskFailed report if !cfg.isHeadless() { go reaper(terminatingReaper) - + installDockerConfig() // We need to checkout dotfiles first, because they may be changing the path which affects the IDE. // TODO(cw): provide better feedback if the IDE start fails because of the dotfiles (provide any feedback at all). installDotfiles(ctx, cfg, tokenService, childProcEnvvars) @@ -376,6 +376,19 @@ func Run(options ...RunOption) { wg.Wait() } +func installDockerConfig() { + const dockerConfigPath = "/home/gitpod/.docker/config.json" + if _, err := os.Stat(dockerConfigPath); err == nil { + // config exists already + return + } + cfgStr := []byte("{\n:\"auths\": {},\n\"credsStore\": \"gp\"}") + err := os.WriteFile(dockerConfigPath, cfgStr, 0600) + if err != nil { + log.WithError(err).Warn("installing docker config failed") + } +} + func installDotfiles(ctx context.Context, cfg *Config, tokenService *InMemoryTokenService, childProcEnvvars []string) { repo := cfg.DotfileRepo if repo == "" {