Skip to content

Commit

Permalink
install docker config
Browse files Browse the repository at this point in the history
  • Loading branch information
tbutter committed Mar 9, 2022
1 parent 9a3bf18 commit d271de3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion components/supervisor/pkg/supervisor/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 == "" {
Expand Down

0 comments on commit d271de3

Please sign in to comment.