Skip to content

chore: add set docker host by current context#9094

Merged
ericzzzzzzz merged 5 commits into
GoogleContainerTools:mainfrom
ericzzzzzzz:set-docker-host-by-current-context
Sep 15, 2023
Merged

chore: add set docker host by current context#9094
ericzzzzzzz merged 5 commits into
GoogleContainerTools:mainfrom
ericzzzzzzz:set-docker-host-by-current-context

Conversation

@ericzzzzzzz

@ericzzzzzzz ericzzzzzzz commented Sep 14, 2023

Copy link
Copy Markdown
Contributor

Fixes: #9028

@pull-request-size pull-request-size Bot added size/M and removed size/S labels Sep 14, 2023
@codecov

codecov Bot commented Sep 14, 2023

Copy link
Copy Markdown

Codecov Report

Merging #9094 (1ce6f9b) into main (290280e) will decrease coverage by 7.06%.
Report is 1028 commits behind head on main.
The diff coverage is 48.90%.

@@            Coverage Diff             @@
##             main    #9094      +/-   ##
==========================================
- Coverage   70.48%   63.43%   -7.06%     
==========================================
  Files         515      628     +113     
  Lines       23150    32293    +9143     
==========================================
+ Hits        16317    20484    +4167     
- Misses       5776    10248    +4472     
- Partials     1057     1561     +504     
Files Changed Coverage Δ
cmd/skaffold/app/cmd/completion.go 13.04% <0.00%> (-1.25%) ⬇️
cmd/skaffold/app/cmd/config/list.go 65.21% <ø> (ø)
cmd/skaffold/app/cmd/config/set.go 88.72% <ø> (ø)
cmd/skaffold/app/cmd/config/util.go 54.28% <ø> (ø)
cmd/skaffold/app/cmd/credits.go 100.00% <ø> (ø)
cmd/skaffold/app/cmd/credits/export.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/deploy.go 40.90% <0.00%> (-12.94%) ⬇️
cmd/skaffold/app/cmd/generate_pipeline.go 60.00% <ø> (ø)
cmd/skaffold/app/cmd/inspect_modules.go 65.00% <0.00%> (ø)
cmd/skaffold/app/cmd/inspect_profiles.go 66.66% <0.00%> (ø)
... and 41 more

... and 431 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ericzzzzzzz ericzzzzzzz marked this pull request as ready for review September 14, 2023 18:02
@ericzzzzzzz ericzzzzzzz marked this pull request as draft September 14, 2023 18:59
@ericzzzzzzz ericzzzzzzz marked this pull request as ready for review September 14, 2023 21:42
@ericzzzzzzz ericzzzzzzz marked this pull request as draft September 15, 2023 11:25
@ericzzzzzzz ericzzzzzzz marked this pull request as ready for review September 15, 2023 11:51
@ericzzzzzzz

Copy link
Copy Markdown
Contributor Author

I was looking into the alternative way to simplify the whole newEnvAPIClient() method with "github.com/docker/cli/cli/command" , https://pkg.go.dev/github.com/docker/cli/cli/command#DockerCli.CurrentContext seems to have everything we need, it also helps set up ssh connection helper implemented in #8349, but it seems that the tls config has different behavior from the current setup, maybe we can revisit this later.

	var opts = []client.Opt{client.WithHTTPHeaders(getUserAgentHeader())}

	cli, err := command.NewDockerCli()
	if err != nil {
		return nil, nil, fmt.Errorf("fail to create dockerCli instance %w", err)
	}
	err = cli.Initialize(flags.NewClientOptions())
	if err != nil {
		return nil, nil, fmt.Errorf("fail to initialize dockerCli instance %w", err)
	}
	endpoint := cli.DockerEndpoint()
	clientOpts, err := endpoint.ClientOpts()
	if err != nil {
		return nil, nil, fmt.Errorf("fail to get dockerCli endpoint options %w", err)
	}
	opts = append(opts, clientOpts...)
	c, err := client.NewClientWithOpts(opts...)
@ericzzzzzzz ericzzzzzzz merged commit 9fd7101 into GoogleContainerTools:main Sep 15, 2023
ialidzhikov added a commit to ialidzhikov/gardener-extension-registry-cache that referenced this pull request Oct 5, 2023
`make extension-up` fails with:
```
Checking cache...
 - eu.gcr.io/gardener-project/gardener/extensions/registry-cache: Error checking cache.
getting imageID for eu.gcr.io/gardener-project/gardener/extensions/registry-cache:v0.1.0-34-g935efc92-dirty: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
```

For a long time I was performing the following workaround:
```
% sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock
```

It seems that the issue is fixed permanently in `skaffold@v2.8.0` with GoogleContainerTools/skaffold#9094. skaffold should now be able to correctly determine to location of the docker socket.
ialidzhikov added a commit to ialidzhikov/gardener-extension-registry-cache that referenced this pull request Oct 5, 2023
`make extension-up` fails with:
```
Checking cache...
 - eu.gcr.io/gardener-project/gardener/extensions/registry-cache: Error checking cache.
getting imageID for eu.gcr.io/gardener-project/gardener/extensions/registry-cache:v0.1.0-34-g935efc92-dirty: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
```

For a long time I was performing the following workaround:
```
% sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock
```

It seems that the issue is fixed permanently in `skaffold@v2.8.0` with GoogleContainerTools/skaffold#9094. skaffold should now be able to correctly determine to location of the docker socket.
ialidzhikov added a commit to ialidzhikov/gardener-extension-registry-cache that referenced this pull request Oct 5, 2023
`make extension-up` fails with:
```
Checking cache...
 - eu.gcr.io/gardener-project/gardener/extensions/registry-cache: Error checking cache.
getting imageID for eu.gcr.io/gardener-project/gardener/extensions/registry-cache:v0.1.0-34-g935efc92-dirty: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
```

For a long time I was performing the following workaround:
```
% sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock
```

It seems that the issue is fixed permanently in `skaffold@v2.8.0` with GoogleContainerTools/skaffold#9094. skaffold should now be able to correctly determine to location of the docker socket.
ialidzhikov added a commit to ialidzhikov/gardener-extension-registry-cache that referenced this pull request Oct 5, 2023
`make extension-up` fails with:
```
Checking cache...
 - eu.gcr.io/gardener-project/gardener/extensions/registry-cache: Error checking cache.
getting imageID for eu.gcr.io/gardener-project/gardener/extensions/registry-cache:v0.1.0-34-g935efc92-dirty: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
```

For a long time I was performing the following workaround:
```
% sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock
```

It seems that the issue is fixed permanently in `skaffold@v2.8.0` with GoogleContainerTools/skaffold#9094. skaffold should now be able to correctly determine to location of the docker socket.
ialidzhikov added a commit to ialidzhikov/gardener-extension-registry-cache that referenced this pull request Oct 5, 2023
`make extension-up` fails with:
```
Checking cache...
 - eu.gcr.io/gardener-project/gardener/extensions/registry-cache: Error checking cache.
getting imageID for eu.gcr.io/gardener-project/gardener/extensions/registry-cache:v0.1.0-34-g935efc92-dirty: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
```

For a long time I was performing the following workaround:
```
% sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock
```

It seems that the issue is fixed permanently in `skaffold@v2.8.0` with GoogleContainerTools/skaffold#9094. skaffold should now be able to correctly determine to location of the docker socket.
ialidzhikov added a commit to ialidzhikov/gardener-extension-registry-cache that referenced this pull request Oct 6, 2023
`make extension-up` fails with:
```
Checking cache...
 - eu.gcr.io/gardener-project/gardener/extensions/registry-cache: Error checking cache.
getting imageID for eu.gcr.io/gardener-project/gardener/extensions/registry-cache:v0.1.0-34-g935efc92-dirty: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
```

For a long time I was performing the following workaround:
```
% sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock
```

It seems that the issue is fixed permanently in `skaffold@v2.8.0` with GoogleContainerTools/skaffold#9094. skaffold should now be able to correctly determine to location of the docker socket.
gardener-prow Bot pushed a commit to gardener/gardener-extension-registry-cache that referenced this pull request Oct 6, 2023
`make extension-up` fails with:
```
Checking cache...
 - eu.gcr.io/gardener-project/gardener/extensions/registry-cache: Error checking cache.
getting imageID for eu.gcr.io/gardener-project/gardener/extensions/registry-cache:v0.1.0-34-g935efc92-dirty: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
```

For a long time I was performing the following workaround:
```
% sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock
```

It seems that the issue is fixed permanently in `skaffold@v2.8.0` with GoogleContainerTools/skaffold#9094. skaffold should now be able to correctly determine to location of the docker socket.
@menahyouyeah menahyouyeah mentioned this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants