Skip to content

fix(kurtosis-devnet): correct fallback for user socket#14907

Closed
pcw109550 wants to merge 2 commits intodevelopfrom
pcw109550/fix-docker-socket-use-host
Closed

fix(kurtosis-devnet): correct fallback for user socket#14907
pcw109550 wants to merge 2 commits intodevelopfrom
pcw109550/fix-docker-socket-use-host

Conversation

@pcw109550
Copy link
Member

@pcw109550 pcw109550 commented Mar 17, 2025

Description

#14884 handled when default docker socket path is not /var/run/docker.sock and uses client.ParseHostURL(client.DefaultDockerHost) to check that at this location exists.

From docker/docker package,

func ParseHostURL(host string) (*url.URL, error) {
	proto, addr, ok := strings.Cut(host, "://")
	if !ok || addr == "" {
		return nil, errors.Errorf("unable to parse docker host `%s`", host)
	}

	var basePath string
	if proto == "tcp" {
		parsed, err := url.Parse("tcp://" + addr)
		if err != nil {
			return nil, err
		}
		addr = parsed.Host
		basePath = parsed.Path
	}
	return &url.URL{
		Scheme: proto,
		Host:   addr,
		Path:   basePath,
	}, nil
}

Since we are using unix socket, we can see Path: basePath is unpopulated but Host is. Fix to make our devnet-sdk code use Host instead of Path.

Tests

Checked local devnet sdk spins up normally.

Additional Context

Fetching proto's diff from #14908

@pcw109550 pcw109550 requested a review from a team as a code owner March 17, 2025 13:32
@pcw109550 pcw109550 requested review from maurelian, sigma and teddyknox and removed request for maurelian March 17, 2025 13:32
@codecov
Copy link

codecov bot commented Mar 17, 2025

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Project coverage is 42.17%. Comparing base (51437d7) to head (27554b1).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
kurtosis-devnet/pkg/build/docker.go 0.00% 10 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #14907      +/-   ##
===========================================
- Coverage    46.31%   42.17%   -4.15%     
===========================================
  Files         1126      954     -172     
  Lines        97513    87316   -10197     
===========================================
- Hits         45161    36822    -8339     
+ Misses       49074    47384    -1690     
+ Partials      3278     3110     -168     
Flag Coverage Δ
cannon-go-tests-32 ?
cannon-go-tests-64 ?
contracts-bedrock-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
kurtosis-devnet/pkg/build/docker.go 43.22% <0.00%> (-2.32%) ⬇️

... and 176 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pcw109550 pcw109550 requested a review from protolambda March 17, 2025 13:50
@pcw109550
Copy link
Member Author

@protolambda I did not pick up the

	// If the user has configured an override,
	// don't change the docker context, client.FromEnv sets up the override already.
	if v := os.Getenv(client.EnvOverrideHost); v != "" {
		return client.NewClientWithOpts(opts...)
	}

part in #14908 because the default options are already handled at

func (p *defaultDockerProvider) newClient() (dockerClient, error) {
	opts := []client.Opt{client.FromEnv}
...

, the first line of method.

@protolambda
Copy link
Contributor

the default options are already handled at

But those get overridden by different options, if the global socket happens to exist. The socket may exist, but that shouldn't mean it's the right context to use. A user docker context, like docker-desktop, or alternative external docker instance, should be usable through the standard env-var override.

@pcw109550
Copy link
Member Author

Closing in behalf of #14911

@pcw109550 pcw109550 closed this Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants