Skip to content

Commit

Permalink
wait for WireGuard tunnel before creating Docker client
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldwan committed Aug 13, 2021
1 parent 302d2fc commit c5fa194
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/build/imgsrc/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ func newRemoteDockerClient(ctx context.Context, apiClient *api.Client, appName s
return errors.Wrapf(err, "error establishing wireguard connection for %s organization", app.Organization.Slug)
}

tunnelCtx, cancel := context.WithTimeout(errCtx, 4*time.Minute)
defer cancel()
if err = agentclient.WaitForTunnel(tunnelCtx, &app.Organization); err != nil {
return errors.Wrap(err, "unable to connect WireGuard tunnel")
}

opts = append(opts, dockerclient.WithDialContext(dialer.DialContext))
} else {
terminal.Debug("connecting to remote docker daemon over host wireguard tunnel")
Expand Down

0 comments on commit c5fa194

Please sign in to comment.